zhztheplayer commented on a change in pull request #1070: [CALCITE-2808]Add the 
JSON_LENGTH function
URL: https://github.com/apache/calcite/pull/1070#discussion_r264505551
 
 

 ##########
 File path: core/src/main/codegen/templates/Parser.jj
 ##########
 @@ -5300,6 +5302,30 @@ SqlCall JsonDepthFunctionCall() :
     }
 }
 
+SqlCall JsonLengthFunctionCall() :
+{
+    final SqlNode[] args = new SqlNode[1];
+    SqlNode e;
+    final Span span;
+    List<SqlNode> behavior;
+}
+{
+    <JSON_LENGTH> { span = span(); }
+    <LPAREN> [
 
 Review comment:
   Thanks @julianhyde,
    
   The implementation (also JSON_TYPE / JSON_DEPTH / JSON_PRETTY) reuses the 
parameter `JsonValueExpression`, which is the common JSON constructor of 
SQL:2016 JSON functions, By doing this the MySQL's JSON functions may also 
support some Non-JSON inputs, for instance, users can use `JSON_TYPE(col FORMAT 
AVRO)` to handle avro input (but currently we don't support avro input yet).
   
   I personally had no objections on this[1]. Do you think we should not use 
`JsonValueExpression` on non-standard JSON operators? Of course it is not in 
MySQL's standard.
   
   And I think we can move `JsonValueExpression` to general `Expression` 
production in the fix of 
[CALCITE-2689](https://issues.apache.org/jira/browse/CALCITE-2869). Once we do 
that, we can also remove the MySQL JSON functions' definition from Parser.jj.
   
   [1] 
https://issues.apache.org/jira/browse/CALCITE-2864?focusedCommentId=16779941&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-16779941

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to