[ https://issues.apache.org/jira/browse/FLINK-20447?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17242886#comment-17242886 ]
Zhenwei Feng commented on FLINK-20447: -------------------------------------- Hi Jark, After I reconsidered the problem, I agree with you. SQL like "select * from table group by pk" is meaningless to some extent. Actually what I'd like to achieve is to create a table in which the data would be updated by PK continously(a snapshot table). I've found the new pattern 'Upsert Kafka' in the doc v1.12, which may solve my problem. > Querying grouy by PK does not work > ---------------------------------- > > Key: FLINK-20447 > URL: https://issues.apache.org/jira/browse/FLINK-20447 > Project: Flink > Issue Type: Improvement > Components: Table SQL / API > Affects Versions: 1.11.2 > Reporter: Zhenwei Feng > Priority: Major > > Since PRIMARY KEY is unique, it should be feasible to screen columns by PK. > The problem could be reproduced by creating a simple table: > {code:java} > CREATE TABLE test_table( > Code STRING, > Name STRING, > ..., > PRIMARY KEY (Code) NOT ENFORCED > )WITH (...) > {code} > then parsing a SQL statement `SELECT *FROM test_table GROUP BY Code`. An > exception as below will be thrown: > > {code:java} > org.apache.calcite.sql.validate.SqlValidatorException: Expression > 'test_table.Name' is not being grouped > {code} > > > > -- This message was sent by Atlassian Jira (v8.3.4#803005)