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


##########
docs/data/sql_functions.yml:
##########
@@ -1685,6 +1685,17 @@ bitmapagg:
       `bitmap BITMAP`
       
       Returns a `BIGINT`.
+  - sql: JSON_LENGTH(json_doc[, path])

Review Comment:
   Add the same content as-is in english to the Chinese doc. It makes sure that 
the document is not forgotten and eventually someone can pick up the translation



##########
docs/data/sql_functions.yml:
##########
@@ -1685,6 +1685,17 @@ bitmapagg:
       `bitmap BITMAP`
       
       Returns a `BIGINT`.
+  - sql: JSON_LENGTH(json_doc[, path])
+    table: jsonLength(jsonObject[, path])
+    description: |
+      Returns the number of elements in a JSON document, or the length of the 
value at the specified path if one is provided. 
+      Returns NULL if the argument is NULL or the path does not locate a value.

Review Comment:
   Yes, please add some concise examples here and in relevant javadocs/table 
api interfaces. Look at json_object or json function for reference and their PRs



##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/SqlJsonUtils.java:
##########
@@ -374,6 +374,27 @@ private static Object errorResultForJsonQuery(
         }
     }
 
+    public static Integer jsonLength(String input, String pathSpec) {

Review Comment:
   We have these utilities here and some other in JsonLengthFuntion.java 
itself. Check if we don't already have utilities for performing the length 
check. If not, check if it makes sense to move the new private utilities you 
added to this file



##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/JsonFunctionsITCase.java:
##########
@@ -97,6 +98,58 @@ Stream<TestSetSpec> getTestSetSpecs() {
         return testCases.stream();
     }
 
+    private static TestSetSpec jsonLengthSpec() {

Review Comment:
   Nice test, following the existing pattern we have



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