Zhenwei Feng created FLINK-20447: ------------------------------------ Summary: 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
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)