Regarding changes to the syntax of the SESSION table function. I am open to 
this, even though it would be a breaking change. Can you give an example of a 
query before and after the syntax change?

I would like to support the new PARTITIONED BY clause for table functions. I 
encourage you to make the change for table functions in general, before and 
separately from the change to the SESSION function and window functions.

Please ensure that the discussion gets added to the JIRA case. It might be best 
if we continue discussion in the JIRA case.

Julian


> On Sep 28, 2021, at 10:28 PM, JING ZHANG <beyond1...@gmail.com> wrote:
> 
> Hi community,
> I'm now working on CALCITE-4337
> <https://issues.apache.org/jira/browse/CALCITE-4337> [1] which aims to
> support PARTITION BY clause for table function argument.
> I've submitted a pull request
> <https://github.com/apache/calcite/pull/2524> [2],
> thanks @Danny very much for review.
> There are two points left which need more discussion. So I fire this
> discussion in order to get more broader suggestions.
> 1. SQL standard Polymorphic Table Functions
> <https://standards.iso.org/ittf/PubliclyAvailableStandards/c069776_ISO_IEC_TR_19075-7_2017.zip>
> [3]
> states:
> 
>> 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.
> 
> 
> A SESSION window has an input table with set semantics which means it
> requires a PARTITION BY clause.
> The new syntax is conflict with current session window table function
> syntax, please take a look at session table function
> <https://calcite.apache.org/docs/reference.html#session> [4].
> *Could we replace the old syntax directly, or take compatible into
> consideration.*
> 2. Based on SQL standard, only input tables with set semantics may be
> partitioned while input table with row semantics may not be partitioned.
> *Should we have separate branch in Parser.jj for set semantic input table
> of table function(Currently, only input table of session window table
> function has set semantics)*?
> 
> Any suggestion is appreciated. Thanks in advanced.
> [1] https://issues.apache.org/jira/browse/CALCITE-4337
> [2] https://github.com/apache/calcite/pull/2524
> [3]
> https://standards.iso.org/ittf/PubliclyAvailableStandards/c069776_ISO_IEC_TR_19075-7_2017.zip
> [4] https://calcite.apache.org/docs/reference.html#session
> 
> Best
> JING ZHANG

Reply via email to