[ 
https://issues.apache.org/jira/browse/CALCITE-3970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17099613#comment-17099613
 ] 

Viliam Durina commented on CALCITE-3970:
----------------------------------------

The standard has this syntax for passing tables as arguments to functions:
{code:sql}
SELECT * FROM TABLE(TUMBLE(TABLE(my_table), ...))
{code}
This syntax is rejected by calcite, that's an issue I think. Maybe there's a 
switch to enable it, I didn't find it. You can support non-standard syntax, but 
the standard syntax should be supported too. The specification only mentions 
this syntax.

> Table-valued function TUMBLE uses non-standard syntax
> -----------------------------------------------------
>
>                 Key: CALCITE-3970
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3970
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.22.0
>            Reporter: Viliam Durina
>            Priority: Major
>
> The currently supported syntax is this:
> {code:java}
> SELECT * FROM TABLE(TUMBLE(TABLE my_table, ...
> {code}
> But the SQL standard specifies that {{my_table}} must be in parentheses, such 
> as here:
> {code:java}
> SELECT * FROM TABLE(TUMBLE(TABLE(my_table), ...
> {code}
> The second syntax is currently rejected with:
> {code:none}
> Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: 
> Encountered "(" at line 1, column 33.
> Was expecting one of:
>     <BRACKET_QUOTED_IDENTIFIER> ...
>     <QUOTED_IDENTIFIER> ...
>     <BACK_QUOTED_IDENTIFIER> ...
>     <IDENTIFIER> ...
>     <UNICODE_QUOTED_IDENTIFIER> ...
> {code}
> I'm not sure if the currently supported syntax is optional, but I think it's 
> not.
> I followed this document: 
> [http://standards.iso.org/ittf/PubliclyAvailableStandards/c069776_ISO_IEC_TR_19075-7_2017.zip]
> The {{TABLE}} clause acts in both ways: (1) to convert a table value to a 
> table object (when used in the {{FROM}} clause to convert the function 
> result) and (2) to convert a table object to a table value (when used to 
> convert arguments to a function).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to