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

lincoln lee commented on CALCITE-6060:
--------------------------------------

The following content is from the discussion in the pull request, paste here 
for easy tracking
 !screenshot-1.png! 

> The named parameter OFFSET in window functions should not conflicts with 
> reserved keywords
> ------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-6060
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6060
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.26.0, 1.35.0
>            Reporter: lincoln lee
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: screenshot-1.png
>
>
> CALCITE-4171 adds support for named params in window function, but the new 
> param name OFFSET conflicts with the reserved keyword, so it can't be used 
> directly, users must use it with double quotes(`OFFSET`),
> which is inconvenient (especially for the built-in window functions, which I 
> think shouldn't occur, actually I tend to think this is a 'bug').
> For example, a case like this:
> {code}
>   @Test void testTableFunctionTumbleWithParamNames() {
>     final String sql = "select *\n"
>         + "from table(\n"
>         + "tumble(\n"
>         + "  DATA => table Shipments,\n"
>         + "  TIMECOL => descriptor(rowtime),\n"
>         + "  SIZE => INTERVAL '1' MINUTE,\n"
>         + "  OFFSET => INTERVAL '-1' MINUTE))";
>     sql(sql).ok();
>   }
> {code}
> will cause SqlParseException:
> {code}
> org.apache.calcite.sql.parser.SqlParseException: Incorrect syntax near the 
> keyword 'OFFSET' at line 8, column 3.
> Was expecting one of:
>     "ABS" ...
>     "ARRAY" ...
>     "AVG" ...
>     ...
> {code}
> Only `OFFSET` works.
> If we agree to rename it, I suggest replacing it with OFFSETSIZE, with the 
> following considerations:
> 1. similar to window size name SIZE, the current name actually omits SIZE, so 
> calling it OFFSETSIZE would be easier for users to understand
> 2. be consistent with TIMECOL without underscores
> 3. btw, we found that Azure Streaming Analytics [1] also uses the name 
> OFFSETSIZE
> 1. 
> https://learn.microsoft.com/en-us/stream-analytics-query/hopping-window-azure-stream-analytics#arguments



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to