Hi all,

It's great to see Calcite already supports PTF syntax and support the
out-of-box new window syntax.

SELECT *
FROM TABLE(TUMBLE(TABLE Bid, DESCRIPTOR(bidtime), INTERVAL '10' MINUTES));

However, some people from the Flink community think that the TABLE()
keyword is a little verbose for users [5].
I have seen the discussion in the previous mailing list [1], and know the
TABLE() keyword is mandatory in SQL standard paper.

But it seems that other databases are not following the standard, I find
that Polymorphic Table Function syntax
 in Oracle is more concise without the TABLE() keywords [2][3], e.g.

SELECT *
FROM skip_col(scott.emp, COLUMNS(comm, hiredate, mgr))

Besides, SQL Server also seems to support the non TABLE() syntax for
table-valued functions [4].
If we can support the Oracle syntax, it would be more consistent with
existing TUMBLE functions
and hence easier to be picked up by users.

The new window TVF syntax can be:

SELECT window_start, count(*)
FROM TUMBLE(Bid, COLUMNS(bidtime), INTERVAL '10' MINUTES))
GROUP BY window_start;

Which is more similar to the existing group window functions:

SELECT TUMBLE_START(bidtime, INTERVAL '10' MINUTES), count(*)
FROM Bid
GROUP BY TUMBLE(bidtime, INTERVAL '10' MINUTES);

I am fairly inexperienced with the parsing and validation logic in Calcite,
so I don't know whether the new syntax can be supported in Calcite.

What do you think?

Best,
Jark

[1]:
https://lists.apache.org/x/thread.html/4a91632b1c780ef9d67311f90fce626582faae7d30a134a768c3d324@%3Cdev.calcite.apache.org%3E
[2]: https://oracle-base.com/articles/18c/polymorphic-table-functions-18c
[3]:
https://docs.oracle.com/en/database/oracle/oracle-database/18/lnpls/plsql-optimization-and-tuning.html#GUID-F8E13DDD-710D-4626-824E-B344849C5AFE
[4]:
https://www.sqlservertutorial.net/sql-server-user-defined-functions/sql-server-table-valued-functions/
[5]:
http://apache-flink-mailing-list-archive.1008284.n3.nabble.com/DISCUSS-FLIP-145-Support-SQL-windowing-table-valued-function-tp45269p45665.html

Reply via email to