Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support using grouping keys that are functions in the select clause #5967

Closed
vpapavas opened this issue Aug 7, 2020 · 1 comment
Closed
Assignees
Labels
bug P1 Slightly lower priority to P0 ;)
Milestone

Comments

@vpapavas
Copy link
Member

vpapavas commented Aug 7, 2020

Describe the bug
This query fails

ksql> CREATE TABLE test2 AS SELECT INITCAP(COL1), COL2, TRIM(COL3), concat(initcap(col1), col2, trim(col3)) AS foo, COUNT(*) FROM input3  GROUP BY INITCAP(col1), col2, TRIM(col3);
Non-aggregate SELECT expression(s) not part of GROUP BY: CONCAT(INITCAP(COL1), COL2, TRIM(COL3))
Either add the column to the GROUP BY or remove it from the SELECT.

The problem is that the AggregateAnalyzer does not recognize that the arguments of function CONCAT in the SELECT clause are actually grouping keys.

To Reproduce
Steps to reproduce the behavior, include:

  1. The version of KSQL.
    master
  2. Sample source data.
CREATE STREAM input3 (id INT KEY, col1 VARCHAR, col2 VARCHAR, col3 VARCHAR, col4 VARCHAR) WITH (kafka_topic='input', value_format='json');
  1. Any SQL statements you ran

Expected behavior
The query succeeds

Actual behaviour

Non-aggregate SELECT expression(s) not part of GROUP BY: CONCAT(INITCAP(COL1), COL2, TRIM(COL3))
Either add the column to the GROUP BY or remove it from the SELECT.
@vpapavas vpapavas added bug needs-triage P0 Denotes must-have for a given milestone labels Aug 7, 2020
@vpapavas vpapavas added this to the 0.12.0 milestone Aug 7, 2020
@vpapavas vpapavas self-assigned this Aug 7, 2020
@AlanConfluent AlanConfluent added P1 Slightly lower priority to P0 ;) and removed P0 Denotes must-have for a given milestone labels Aug 10, 2020
@agavra
Copy link
Contributor

agavra commented Aug 21, 2020

I think the above PR fixes this, closing out this ticket as bookkeeping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug P1 Slightly lower priority to P0 ;)
Projects
None yet
Development

No branches or pull requests

3 participants