Danny Chen created CALCITE-4396: ----------------------------------- Summary: Allows table valued functions of FROM and JOIN context without TABLE clause Key: CALCITE-4396 URL: https://issues.apache.org/jira/browse/CALCITE-4396 Project: Calcite Issue Type: Improvement Components: core Affects Versions: 1.26.0 Reporter: Danny Chen Assignee: Danny Chen Fix For: 1.27.0
In current code base, user can use a table valued function mainly for 2 kinds of SQL statements: {code:sql} -- select from the table valued function directly SELECT ... FROM TABLE(my_tvf(...)); -- join the table valued function with LATERAL keyword ... t1 JOIN LATERAL TABLE(my_tvf(...)) ON ... {code} While since version 12.1+, Oracle supports syntax without TABLE keyword, thus you can write SQL as following: {code:sql} -- select from the table valued function directly SELECT ... FROM my_tvf(...); -- join the table valued function with LATERAL keyword ... t1 JOIN my_tvf(...) ON ... {code} SQL-SERVER also allows select from the table valued function directly without the explicit TABLE keyword, but they need the CROSS APPLY clause for table and function join. [2] We already had a discussion on the DEV mailing list, see [3]. I propose to support the Oracle style table valued function syntax: to omit the TABLE keyword because the syntax is straight-forward and concise. Of course, this syntax is only valid under Oracle SQL conformance. [1] https://livesql.oracle.com/apex/livesql/file/tutorial_GSOTSK8FWLYZOG5CJJ9KPX7RX.html [2] https://docs.microsoft.com/en-us/sql/relational-databases/user-defined-functions/create-user-defined-functions-database-engine?view=sql-server-ver15#TVF [3] https://lists.apache.org/x/thread.html/ra98db08e280ddd9adeef62f456f61aedfdf7756e215cb4d66e2a52c9@%3Cdev.calcite.apache.org%3E -- This message was sent by Atlassian Jira (v8.3.4#803005)