Standard SQL doesn’t allow functions in the FROM clause. I think it’s because tables and functions are in different namespaces (and therefore there could be a table and a function with the same name). So you need to use the TABLE keyword to indicate that you are using a function as a table.
This has been discussed before; see https://issues.apache.org/jira/browse/CALCITE-1472?focusedCommentId=15662182&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-15662182 <https://issues.apache.org/jira/browse/CALCITE-1472?focusedCommentId=15662182&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15662182>. > On Aug 29, 2019, at 2:37 PM, Rui Wang <[email protected]> wrote: > > Hi Community, > > I have been searching and trying Calcite's query syntax to match > CALCITE-3272 <https://jira.apache.org/jira/browse/CALCITE-3272> (TUBME as a > table function call). > > Currently, the closest syntax in Calcite I found is: > > FROM TABLE(TUMBLE(params...)) > > The better syntax should be: > > FROM TUMBLE(params..), which basically is the form of FROM > table_function_name(params...). > > > > Is the second option already supported by Calcite? if not, would it be > better to go to support it? > > > -Rui
