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

Hongze Zhang commented on CALCITE-883:
--------------------------------------

Thank you for starting the discussion here, [~Chunwei Lei] and [~julianhyde].

It is usually a little difficult for me too to choose a best place to add new 
options of function syntax. For helping solve the problem I just summarized a 
simple table about the placed classes of the generic syntax options in Calcite:

||Class Name||{{WIN_AGG() OVER(...)}}||{{WIN_AGG() OVER(... ORDER BY 
...)}}||{{AGG() WITHIN GROUP(...)}}||{{AGG(DISTINCT / ALL ...)}}||{{AGG() 
FILTER(...)}} 
|SqlOperator|-|-|-|-|-|
|SqlFunction|-|-|-|-|-|
|SqlAggFunction|requiresOver:boolean|requiresOrder:boolean|requiresGroupOrder:Optionality|-|-|
|SqlCall|-|-|-|-|-|
|SqlBasicCall|-|-|-|functionQuantifier:SqlLiteral|-|
|RexCall|-|-|-|-|-|
|RexOver|-|-|-|distinct:boolean|-|
|AggregateCall|-|-|collation:RelCollation|distinct:boolean|filterArg:int|
|o.a.c.rel.core.Window.RexWinAggCall|-|-|-|distinct:boolean|-|
|o.a.c.rel.core.Window.Group|-|orderKeys:RelCollation|-|-|-|

[~Chunwei Lei] - And now in PR #1108 you have added null treatment option to 
five places: {{SqlCall}}, {{SqlBasicCall}}, {{RexOver}}, {{AggregateCall}}, 
{{o.a.c.rel.core.Window.Group}}, I think this is a little too much, right? As a 
comparison, if you add a "NULL TREATMENT" operator you should only have to 
change the class {{AggregateCall}}. Or if the syntax is only for window 
functions, you can also somehow limit the change to {{RexOver}} / 
{{o.a.c.rel.core.Window.RexWinAggCall}} / {{o.a.c.rel.core.Window.Group}}. 
Either way the modification of {{SqlCall}} / {{SqlBasicCall}} can be avoided.


> RESPECT NULLS, IGNORE NULLS option for LEAD, LAG window functions
> -----------------------------------------------------------------
>
>                 Key: CALCITE-883
>                 URL: https://issues.apache.org/jira/browse/CALCITE-883
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Sean Hsuan-Yi Chu
>            Assignee: Chunwei Lei
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> This issue was brought up in Drill community: 
> (https://issues.apache.org/jira/browse/DRILL-3597)
> For convenience, I copied and pasted the reporter Khurram Faraaz's 
> description here:
> "The SQL standard defines a RESPECT NULLS or IGNORE NULLS option for lead, 
> lag, first_value, and last_value window functions."
> In Calcite, we should have been able to recognized this option.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to