[
https://issues.apache.org/jira/browse/FLINK-24024?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17408153#comment-17408153
]
Timo Walther commented on FLINK-24024:
--------------------------------------
[~qingru zhang] Let's move this discussion on the mailing list as it is a FLIP
change anyway. But I don't think that Calcite's documentation is correct here.
The standard states:
{code}
Input tables have either row semantics or set semantics, as follows:
a) Row semantics means that the the result of the PTF is decided on a
row-by-row basis. As an extreme example, the DBMS could atomize the input table
into individual rows, and send each single row to a different virtual processor.
b) Set semantics means that the outcome of the function depends on how the data
is partitioned. A partition may not be split across virtual processors, nor may
a virtual processor handle more than one partition.
{code}
A SESSION window has an input table with set semantics which means it requires
a PARTITION BY and I guess even a ORDER BY.
Please have a look at
https://standards.iso.org/ittf/PubliclyAvailableStandards/c069776_ISO_IEC_TR_19075-7_2017.zip
> 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
> Assignee: JING ZHANG
> Priority: Blocker
> Labels: pull-request-available
> Fix For: 1.14.0, 1.15.0
>
>
> There is a syntax mistake in session Window TVF in FLINK-23544 .
> 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)