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


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/JsonFunctionsITCase.java:
##########
@@ -821,12 +821,18 @@ private static List<TestSetSpec> jsonSpec() {
                                         json("[1, 2, 3]")),
                                 "JSON_OBJECT(KEY 'p1' VALUE JSON(f0), KEY 'p2' 
VALUE JSON(f1), KEY 'p3' VALUE JSON('[1, 2, 3]'))",
                                 
"{\"p1\":{\"key\":\"value\"},\"p2\":{\"key\":{\"value\":42}},\"p3\":[1,2,3]}",
-                                STRING().notNull()),
-
-                // Tests for JSON calls inside of JSON_ARRAY
-                TestSetSpec.forFunction(BuiltInFunctionDefinitions.JSON_ARRAY)
-                        .onFieldsWithData("{\"key\":\"value\"}", "{\"key\": 
{\"value\": 42}}")
-                        .andDataTypes(STRING(), STRING())
+                                STRING().notNull())
+                        .testSqlValidationError(
+                                "JSON_OBJECT(KEY JSON('{}') VALUE 'value' 
ABSENT ON NULL)",
+                                "The JSON() function is currently only 
supported inside a JSON_OBJECT() or JSON_ARRAY() function.")

Review Comment:
   The full message contains examples that should help the user understand the 
expected use. 
[See](https://github.com/apache/flink/blob/e30c207e371794adaac0261ed20a58a7c812f192/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/ExprCodeGenerator.scala#L467):
   
   ```
   The JSON() function is currently only supported inside a JSON_OBJECT() or 
JSON_ARRAY()" +
             " function. Example: JSON_OBJECT('a', JSON('{"key": "value"}')) or 
" +
             "JSON_ARRAY(JSON('{"key": "value"}')).
   ```
   
   Do you think that's clear enough? Let me know if you have a specific 
suggestion



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to