Hi, all, in the last 2 releases, Rui Wang has contributed the window table 
functions to replace the legacy group window syntax, the idea comes from the 
SQL-2016 polymorphic table functions. But the current implementation also got 
some feedbacks(or confusion), this thread tries to have a discussion on theses 
questions that are undecided.

One is about the window function argument names:

=== option1
TUMBLE(table, DESCRIPTOR(datetime), interval, offset)
HOP(table, DESCRIPTOR(time_column), slide, size)

=== option2
TUMBLE(table, DESCRIPTOR(time_column), size, offset)
HOP(table, DESCRIPTOR(time_column), size, hop_size, offset)

I would prefer for option2 for the reasons pointed out by Viliam in 
CALCITE-3737.


Another is about how to translate the query

For query, select * from TUMBLE(table, DESCRIPTOR(time_column), interval);

Currently our outputs plan is:

LogicalProject(ORDERID=[$0], ROWTIME=[$1], window_start=[$2], window_end=[$3])
LogicalTableFunctionScan(invocation=[TUMBLE(DESCRIPTOR($1), interal:INTERVAL 
MINUTE)], rowType=[RecordType(INTEGER ORDERID, TIMESTAMP(0) time_column, 
TIMESTAMP(0) window_start, TIMESTAMP(0) window_end)])
LogicalProject(ORDERID=[$0], ROWTIME=[$1])
LogicalTableScan(table=[[CATALOG, SALES, SHIPMENTS]])

But this seems not right, because the "table table_name" argument is not a 
relational expression, in CALCITE-3955, Julian has pointed out that we should 
translate the "table" argument as a CURSOR (or TABLE by Viliam), but another 
question is how to translate the referenced name "time_column", to a correlate 
variable ? which is also confusing because there is no correlation in the plan 
actually.

Any suggestions are appreciated !


[1] https://issues.apache.org/jira/browse/CALCITE-3955
[2] https://issues.apache.org/jira/browse/CALCITE-3737

Best,
Danny Chan

Reply via email to