diff --git a/docs/data/sql_functions.yml b/docs/data/sql_functions.yml index 8dc465da407a3..d25223c5f20ae 100644 --- a/docs/data/sql_functions.yml +++ b/docs/data/sql_functions.yml @@ -1352,7 +1352,7 @@ variant: - sql: TRY_PARSE_JSON(json_string[, allow_duplicate_keys]) table: STRING.tryParseJson([allowDuplicateKeys]) description: | - Try to parse a JSON string into a Variant if possible. If the JSON string is invalid, return + Try to parse a JSON string into a Variant if possible. If the JSON string is invalid, return NULL. To throw an error instead of returning NULL, use the `PARSE_JSON` function. If there are duplicate keys in the input JSON string, when `allowDuplicateKeys` is true, the diff --git a/flink-python/pyflink/table/expression.py b/flink-python/pyflink/table/expression.py index be21605124a3a..5212de11f862c 100644 --- a/flink-python/pyflink/table/expression.py +++ b/flink-python/pyflink/table/expression.py @@ -2303,8 +2303,8 @@ def try_parse_json(self, allow_duplicate_keys=None) -> 'Expression': None is returned. To throw an error instead, use :func:`~Expression.parse_json`. If there are duplicate keys in the input, allow_duplicate_keys controls whether the - parser keeps the last occurrence of each duplicated key (True) or throws an error - (False). The default value of allow_duplicate_keys is False. + parser keeps the last occurrence of each duplicated key (True) or returns + None (False). The default value of allow_duplicate_keys is False. """ if allow_duplicate_keys is None: return _unary_op("tryParseJson")(self) diff --git a/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java b/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java index 536105ea6bce6..3aa6923461e56 100644 --- a/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java +++ b/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/BaseExpressions.java @@ -1411,8 +1411,8 @@ public OutType tryParseJson() { * #parseJson(boolean)}. * *
If there are duplicate keys in the input, {@code allowDuplicateKeys} controls whether the - * parser keeps the last occurrence of each duplicated key ({@code true}) or throws an error - * ({@code false}). + * parser keeps the last occurrence of each duplicated key ({@code true}) or returns {@code + * NULL} ({@code false}). */ public OutType tryParseJson(boolean allowDuplicateKeys) { return toApiSpecificExpression(