[ https://issues.apache.org/jira/browse/FLINK-31960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17724680#comment-17724680 ]
Jark Wu edited comment on FLINK-31960 at 5/21/23 3:29 PM: ---------------------------------------------------------- [~padavan], ROW/RANGE clause is not allowed for the LEAD/LAG functions. You can remove the last "{{RANGE BETWEEN INTERVAL '1' MINUTE PRECEDING AND CURRENT ROW}}" statement and try again I think the exception message can be improved but that exception is thrown by Calcite, and we can report this to the Calcite community. was (Author: jark): [~padavan], ROW/RANGE clause is not allowed for the LEAD/LAG functions. You can remove the last RANGE statement and try again {{RANGE BETWEEN INTERVAL '1' MINUTE PRECEDING AND CURRENT ROW}}. I think the exception message can be improved but that exception is thrown by Calcite, and we can report this to the Calcite community. > SQL OverBy. Error on a code that does not exist > ------------------------------------------------ > > Key: FLINK-31960 > URL: https://issues.apache.org/jira/browse/FLINK-31960 > Project: Flink > Issue Type: Bug > Components: Table SQL / API > Affects Versions: 1.17.0 > Reporter: padavan > Priority: Major > > Hello. I use latest Flink. And want make query with LEAD, LAG function , but > i got error > {noformat} > SQL validation failed. From line 1, column 138 to line 1, column 142: > ROW/RANGE not allowed with RANK, DENSE_RANK or ROW_NUMBER functions{noformat} > But i dont use RANK, DENSE_RANK or ROW_NUMBER functions in my code > {code:java} > Table win = te.sqlQuery( > "SELECT userId, " + > "lead(`count`, 1) over w as ld, " + > "lag(`count`, 1) over w as lg " + > "FROM users " + > "WINDOW w AS (" + > "PARTITION BY userId " + > "ORDER BY proctime " + > "RANGE BETWEEN INTERVAL '1' MINUTE PRECEDING AND CURRENT ROW)" > );{code} > > I found what this problem is fix in 2020 but not... > [https://github.com/apache/flink/pull/12868] -- This message was sent by Atlassian Jira (v8.20.10#820010)