[FLINK-40852][table] Return NULL from PARSE_JSON and TRY_PARSE_JSON for NULL allowDuplicateKeys - #29343
Open
manner wants to merge 3 commits into
Open
[FLINK-40852][table] Return NULL from PARSE_JSON and TRY_PARSE_JSON for NULL allowDuplicateKeys#29343manner wants to merge 3 commits into
manner wants to merge 3 commits into
Conversation
raminqaf
reviewed
Sep 30, 2026
raminqaf
reviewed
Sep 30, 2026
…JSON and TRY_PARSE_JSON A NULL allowDuplicateKeys now behaves like the default false instead of returning NULL. The docs mention this, and the TRY_PARSE_JSON docs now say that duplicate keys return NULL instead of throwing an error. Generated-by: Claude Opus 5.5 [FLINK-40852][table] Treat NULL allowDuplicateKeys as false in PARSE_JSON and TRY_PARSE_JSON A NULL allowDuplicateKeys now behaves like the default false instead of returning NULL. The docs mention this, and the TRY_PARSE_JSON docs now say that duplicate keys return NULL instead of throwing an error. Generated-by: Claude Opus 5.5
FLINK-40854 changed the message to "Failed to parse JSON string". Generated-by: Claude Opus 5.5
…ity of PARSE_JSON A NULL allowDuplicateKeys is treated as false and can't make the result NULL, so only the JSON string decides whether the result is nullable. Generated-by: Claude Opus 5.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
PARSE_JSONandTRY_PARSE_JSONaccept anyBOOLEANexpression as the second argument (allowDuplicateKeys), not only literals. The runtime functions declared it as a primitiveboolean, so a NULL value failed with aNullPointerExceptionduring unboxing:The same happens for a nullable
BOOLEANcolumn that is NULL for a row. With this change both functions return NULL in that case. The output type strategies (nullableIfArgs/forceNullable) already allow a NULL result.JIRA: https://issues.apache.org/jira/browse/FLINK-40852
Brief change log
ParseJsonFunctionandTryParseJsonFunctiontake@Nullable Boolean allowDuplicateKeysand return NULL if it is NULL.Verifying this change
This change added tests and can be verified as follows:
JsonFunctionsITCaseforPARSE_JSONandTRY_PARSE_JSONwith a NULLBOOLEANcolumn asallowDuplicateKeys, expecting NULL. Both failed with the NPE before the fix.There are no Table API cases for this because
parseJson(boolean)/tryParseJson(boolean)only accept a literal.Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Opus 5.5
🤖 Generated with Claude Code