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 2020/05/01 07:35:37 UTC

[GitHub] [calcite] XuQianJin-Stars opened a new pull request #1955: [CALCITE-3941] Add the default strict mode to the path in the Json functions

XuQianJin-Stars opened a new pull request #1955:
URL: https://github.com/apache/calcite/pull/1955


   As illustrated in [CALCITE-3941](https://issues.apache.org/jira/browse/CALCITE-3724)


----------------------------------------------------------------
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



[GitHub] [calcite] XuQianJin-Stars commented on a change in pull request #1955: [CALCITE-3941] Add the default strict mode to the path in the Json functions

Posted by GitBox <gi...@apache.org>.
XuQianJin-Stars commented on a change in pull request #1955:
URL: https://github.com/apache/calcite/pull/1955#discussion_r439800394



##########
File path: core/src/main/java/org/apache/calcite/runtime/JsonFunctions.java
##########
@@ -112,18 +113,22 @@ public static JsonPathContext jsonApiCommonSyntax(String input, String pathSpec)
   }
 
   public static JsonPathContext jsonApiCommonSyntax(JsonValueContext input, String pathSpec) {
+    PathMode mode;
+    String pathWff;
     try {
       Matcher matcher = JSON_PATH_BASE.matcher(pathSpec);
       if (!matcher.matches()) {
-        throw RESOURCE.illegalJsonPathSpec(pathSpec).ex();
+        mode = PathMode.STRICT;
+        pathWff = pathSpec;

Review comment:
       > false on error
   
   The exception was handled and returned as false.




----------------------------------------------------------------
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



[GitHub] [calcite] chunweilei merged pull request #1955: [CALCITE-3941] Add the default strict mode to the path in the Json functions

Posted by GitBox <gi...@apache.org>.
chunweilei merged pull request #1955:
URL: https://github.com/apache/calcite/pull/1955


   


----------------------------------------------------------------
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



[GitHub] [calcite] chunweilei commented on a change in pull request #1955: [CALCITE-3941] Add the default strict mode to the path in the Json functions

Posted by GitBox <gi...@apache.org>.
chunweilei commented on a change in pull request #1955:
URL: https://github.com/apache/calcite/pull/1955#discussion_r422465130



##########
File path: core/src/main/java/org/apache/calcite/runtime/JsonFunctions.java
##########
@@ -112,18 +113,22 @@ public static JsonPathContext jsonApiCommonSyntax(String input, String pathSpec)
   }
 
   public static JsonPathContext jsonApiCommonSyntax(JsonValueContext input, String pathSpec) {
+    PathMode mode;
+    String pathWff;
     try {

Review comment:
       What does `pathWff` mean? Should we change it to a more clearer name?




----------------------------------------------------------------
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



[GitHub] [calcite] chunweilei commented on a change in pull request #1955: [CALCITE-3941] Add the default strict mode to the path in the Json functions

Posted by GitBox <gi...@apache.org>.
chunweilei commented on a change in pull request #1955:
URL: https://github.com/apache/calcite/pull/1955#discussion_r422465538



##########
File path: core/src/main/java/org/apache/calcite/runtime/JsonFunctions.java
##########
@@ -112,18 +113,22 @@ public static JsonPathContext jsonApiCommonSyntax(String input, String pathSpec)
   }
 
   public static JsonPathContext jsonApiCommonSyntax(JsonValueContext input, String pathSpec) {
+    PathMode mode;
+    String pathWff;
     try {
       Matcher matcher = JSON_PATH_BASE.matcher(pathSpec);
       if (!matcher.matches()) {
-        throw RESOURCE.illegalJsonPathSpec(pathSpec).ex();
+        mode = PathMode.STRICT;
+        pathWff = pathSpec;

Review comment:
       What if there is an illegal mode? For instance, json_exists('{\"foo\":\"bar\"}', "strictxx $.foo' false on error)". Will it throw exception?




----------------------------------------------------------------
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



[GitHub] [calcite] chunweilei commented on a change in pull request #1955: [CALCITE-3941] Add the default strict mode to the path in the Json functions

Posted by GitBox <gi...@apache.org>.
chunweilei commented on a change in pull request #1955:
URL: https://github.com/apache/calcite/pull/1955#discussion_r422465538



##########
File path: core/src/main/java/org/apache/calcite/runtime/JsonFunctions.java
##########
@@ -112,18 +113,22 @@ public static JsonPathContext jsonApiCommonSyntax(String input, String pathSpec)
   }
 
   public static JsonPathContext jsonApiCommonSyntax(JsonValueContext input, String pathSpec) {
+    PathMode mode;
+    String pathWff;
     try {
       Matcher matcher = JSON_PATH_BASE.matcher(pathSpec);
       if (!matcher.matches()) {
-        throw RESOURCE.illegalJsonPathSpec(pathSpec).ex();
+        mode = PathMode.STRICT;
+        pathWff = pathSpec;

Review comment:
       What if there is an illegal mode? For instance, `json_exists('{\"foo\":\"bar\"}', "strictxx $.foo' false on error)`. Will it throw exception?




----------------------------------------------------------------
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