[
https://issues.apache.org/jira/browse/CALCITE-6254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17815804#comment-17815804
]
Julian Hyde edited comment on CALCITE-6254 at 2/8/24 7:08 PM:
--------------------------------------------------------------
Also note that {{TABLE tableName}} is a separate syntax from {{TABLE (function
(arg, ...))}}, and will remain valid. This form defines a query, so you can use
{{TABLE}} anywhere that you can use {{SELECT}}.
{code}
# TABLE is a valid query
TABLE emp;
# And a valid sub-query (inside parentheses)
SELECT * FROM (TABLE emp) AS e;
{code}
was (Author: julianhyde):
Also note that {{TABLE tableName}} is a separate syntax from {{TABLE (function
(arg, ...)}}, and will remain valid. This form defines a query, so you can use
{{TABLE}} anywhere that you can use {{SELECT}}.
{code}
# TABLE is a valid query
TABLE emp;
# And a valid sub-query (inside parentheses)
SELECT * FROM (TABLE emp) AS e;
{code}
> Enable calling table functions without requiring TABLE() wrapper
> ----------------------------------------------------------------
>
> Key: CALCITE-6254
> URL: https://issues.apache.org/jira/browse/CALCITE-6254
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.36.0
> Reporter: Barry Kelly
> Priority: Minor
> Labels: parser
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Currently, when selecting from a table function, the function call needs to
> be wrapped in TABLE() like this:
> {{ SELECT * FROM TABLE(table_func('args'));}}
> Many dialects (SQL Server, PostgreSQL, BigQuery) do not require this:
> {{ SELECT * FROM table_func('args');}}
> The current Calcite grammar can be extended to permit this syntax without
> conflicting with other productions.
> There is a close call with the dynamic columns feature used by
> [Phoenix|https://phoenix.apache.org/dynamic_columns.html]
> {{ SELECT * FROM EventLog(lastGCTime TIME)}}
> It can be disambiguated with 3 tokens of lookahead, seeing past the '(' and
> identifier to the presence of a type production. The table extension clause
> for dynamic columns requires at least one field, so the empty case of '()' is
> not ambiguous either.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)