snuyanzin commented on code in PR #28688:
URL: https://github.com/apache/flink/pull/28688#discussion_r3701615644


##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/SqlJsonUtils.java:
##########
@@ -374,6 +389,72 @@ private static Object errorResultForJsonQuery(
         }
     }
 
+    /** Accepts a pre-parsed context from {@link #jsonParse}. */
+    public static Integer jsonLength(final JsonValueContext parsedInput) {
+        // TODO FLINK-40233: A null context can result from a shared parse 
that was short-circuited
+        // before parsing.
+        if (parsedInput.hasException()) {

Review Comment:
   `parsedInput` might be `null` if input was `null` e.g. for queries
   ```
   SELECT json_value(v, cast(null as string)), json_length(v) FROM 
(values('{"a":1, "b":2}')) AS t(v);
   ```



##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/SqlJsonUtils.java:
##########
@@ -374,6 +389,72 @@ private static Object errorResultForJsonQuery(
         }
     }
 
+    /** Accepts a pre-parsed context from {@link #jsonParse}. */
+    public static Integer jsonLength(final JsonValueContext parsedInput) {
+        // TODO FLINK-40233: A null context can result from a shared parse 
that was short-circuited
+        // before parsing.
+        if (parsedInput.hasException()) {

Review Comment:
   `parsedInput` might be `null` if input was `null` e.g. for queries
   ```sql
   SELECT json_value(v, cast(null as string)), json_length(v) FROM 
(values('{"a":1, "b":2}')) AS t(v);
   ```



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to