You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/03/18 02:37:44 UTC

[GitHub] [calcite] chunweilei commented on a change in pull request #1108: [CALCITE-863] Support RESPECT NULLS, IGNORE NULLS option for lead, lag, first_value, last_value function

chunweilei commented on a change in pull request #1108: [CALCITE-863] Support RESPECT NULLS, IGNORE NULLS option for lead, lag, first_value, last_value function
URL: https://github.com/apache/calcite/pull/1108#discussion_r266279847
 
 

 ##########
 File path: core/src/main/codegen/templates/Parser.jj
 ##########
 @@ -5678,8 +5679,19 @@ SqlNode NamedFunctionCall() :
             args.remove(0);
         }
     )
+    [
+        (
+            <IGNORE> { s1 = span(); } <NULLS> {
+                ignoreNulls = SqlLiteral.createBoolean(true, s1.end(this));
+            }
+        |
+            <RESPECT> { s1 = span(); } <NULLS> {
+                ignoreNulls = SqlLiteral.createBoolean(false, s1.end(this));
+            }
+        )
+    ]
     {
-        call = createCall(qualifiedName, s.end(this), funcType, quantifier, args);
+        call = createCall(qualifiedName, s.end(this), funcType, quantifier, ignoreNulls, args);
 
 Review comment:
   @zhztheplayer I spent some time on figuring out whether your proposal works. It seems that it can't work due to unable to find the right function which ignores nulls. Because the function has been resolved to the function which respects nulls when creating `RESPECT_NULLS(AGG)` unless we use different name for the functions which seems a little hacky.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services