Hi, Pouria Flink SQL uses the calcite to parse SQL, this is the calcite limitation, the minimum precision it supports is Second [1].
[1] https://github.com/apache/calcite/blob/main/core/src/main/codegen/templates/Parser.jj#L5067 Best, Ron Pouria Pirzadeh <pouria.pirza...@gmail.com> 于2023年8月15日周二 08:09写道: > I am trying to run a window aggregation SQL query (on Flink 1.16) with > Windowing TVF for a TUMBLE window with a size of 5 Milliseconds it seems > Flink does not let a window size use a time unit smaller than seconds. Is > that correct? > (The documentation > <https://nightlies.apache.org/flink/flink-docs-release-1.15/docs/dev/table/sql/queries/window-tvf/#tumble> > is not clear about that.) > > It is unexpected given that the datastream API lets defining a tumbling > window > <https://nightlies.apache.org/flink/flink-docs-release-1.15/docs/dev/datastream/operators/windows/#tumbling-windows> > with a size in milliseconds using: > window(TumblingProcessingTimeWindows.of(Time.seconds(5))) > > Here is the query: > SELECT window_start, window_end, userid, count(pageid) AS cnt > FROM TABLE(TUMBLE(TABLE pageviews, DESCRIPTOR(rowtime), INTERVAL '5' > MILLISECONDS)) > GROUP BY window_start, window_end, userid; > > error: > SQL parse failed. Encountered "MILLISECONDS" at line 1, column 142. > Was expecting one of: > "DAY" ... > "DAYS" ... > "HOUR" ... > "HOURS" ... > "MINUTE" ... > "MINUTES" ... > "MONTH" ... > "MONTHS" ... > "SECOND" ... > "SECONDS" ... > "YEAR" ... > "YEARS" ... >