[ https://issues.apache.org/jira/browse/FLINK-19444?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17203730#comment-17203730 ]
CloseRiver commented on FLINK-19444: ------------------------------------ Hi [~johnhuster],window should be defined on event-time or processing-time,you can add proctime or define rowtime base on create_time. > flink 1.11 sql group by tumble Window aggregate can only be defined over a > time attribute column, but TIMESTAMP(3) encountered > ------------------------------------------------------------------------------------------------------------------------------ > > Key: FLINK-19444 > URL: https://issues.apache.org/jira/browse/FLINK-19444 > Project: Flink > Issue Type: Bug > Components: Table SQL / API > Affects Versions: 1.11.2 > Reporter: panxiaohu > Priority: Major > > Here's the code: > String createSql = "CREATE TABLE clicks (\n" + > " `user` STRING,\n" + > " create_time TIMESTAMP(3),\n" + > " PRIMARY KEY (`user`) NOT ENFORCED\n" + > ") WITH (\n" + > " 'connector' = 'jdbc',\n" + > " 'url' = 'jdbc:mysql://localhost:3306/learning',\n" + > " 'username' = 'root',\n" + > " 'password' = 'john123',\n" + > " 'table-name' = 'clicks'\n" + > ")"; > Table table = tableEnv.sqlQuery("select user,TUMBLE_START(create_time, > INTERVAL '1' DAY),count(user) from clicks group by TUMBLE(create_time, > INTERVAL '1' DAY),user" ); > > then exception occurs as follows: > org.apache.flink.table.api.TableException: Window aggregate can only be > defined over a time attribute column, but TIMESTAMP(3) > encountered.org.apache.flink.table.api.TableException: Window aggregate can > only be defined over a time attribute column, but TIMESTAMP(3) encountered. > at > org.apache.flink.table.planner.plan.rules.logical.StreamLogicalWindowAggregateRule.getInAggregateGroupExpression(StreamLogicalWindowAggregateRule.scala:50) > at > org.apache.flink.table.planner.plan.rules.logical.LogicalWindowAggregateRuleBase.onMatch(LogicalWindowAggregateRuleBase.scala:79) > at > org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:328) > at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:562) at > org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:427) at > org.apache.calcite.plan.hep.HepPlanner.executeInstruction(HepPlanner.java:264) > at > org.apache.calcite.plan.hep.HepInstruction$RuleInstance.execute(HepInstruction.java:127) -- This message was sent by Atlassian Jira (v8.3.4#803005)