MartijnVisser commented on code in PR #30136:
URL: https://github.com/apache/flink/pull/30136#discussion_r4774143793


##########
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/JsonFunctionsITCase.java:
##########
@@ -468,6 +469,22 @@ private static TestSetSpec jsonExistsSpec() {
                 .testSqlResult("JSON_EXISTS(f0, '$.metadata.tags[*]')", true, 
BOOLEAN());
     }
 
+    private static TestSetSpec jsonExistsSpecWithInvalidInput() {
+        return TestSetSpec.forFunction(BuiltInFunctionDefinitions.JSON_EXISTS, 
"Invalid input")
+                .onFieldsWithData(Row.of(1, "x"), 1)
+                .andDataTypes(ROW(FIELD("a", INT()), FIELD("b", STRING())), 
INT())
+                .testSqlValidationError(
+                        "JSON_EXISTS(f0, '$.a')",
+                        "Unsupported type 'ROW<`a` INT, `b` STRING>' for the 
first argument of "
+                                + "JSON_EXISTS(). Supported types are CHAR, 
VARCHAR and STRING. "
+                                + "Use JSON_STRING() to convert a value of 
another type to a JSON "
+                                + "string.")
+                .testSqlValidationError(
+                        "JSON_EXISTS(f1, '$.a' FALSE ON ERROR)",
+                        "Unsupported type 'INT' for the first argument of 
JSON_EXISTS().")
+                .testSqlResult("JSON_EXISTS(JSON_STRING(f0), '$.a')", true, 
BOOLEAN());

Review Comment:
   These cases still pass with `isString` instead of `isCharacter`. A BYTES 
case would cover binary strings, which is also where the hint goes wrong.



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