JING ZHANG created FLINK-24024:
----------------------------------
Summary: Fix syntax mistake in session Window TVF
Key: FLINK-24024
URL: https://issues.apache.org/jira/browse/FLINK-24024
Project: Flink
Issue Type: Bug
Components: Table SQL / API
Affects Versions: 1.14.0
Reporter: JING ZHANG
There is a syntax mistake in session Window TVF in FLINK-23543.
For example, the following SQL has syntax mistake.
{code:java}
"""
|SELECT
| a,
| window_start,
| window_end,
| count(*),
| sum(d),
| max(d) filter (where b > 1000),
| count(distinct c) AS uv
|FROM TABLE(
| SESSION(
| TABLE MyTable,
| DESCRIPTOR(proctime),
| INTERVAL '5' MINUTE))
|GROUP BY a, window_start, window_end
""".stripMargin
{code}
It should updated to the following SQL, while partition key (a) should be moved
into SESSION
Window TVF based on Calcite [SESSION window
TVF|https://calcite.apache.org/docs/reference.html#session].
{code:java}
val sql =
"""
|SELECT
| a,
| window_start,
| window_end,
| count(*),
| sum(d),
| max(d) filter (where b > 1000),
| count(distinct c) AS uv
|FROM TABLE(
| SESSION(
| TABLE MyTable,
| DESCRIPTOR(proctime),
| DESCRIPTOR(a)
| INTERVAL '5' MINUTE))
|GROUP BY a, window_start, window_end
""".stripMargin{code}
To fix the bug, we only need update Session Window TVF syntax, we don't need
update the operator part.
Besides, we should check group keys of window aggregate should only contain
window_start, window_end, partition_key. group keys could not contain other
fields.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)