[FLINK-40545][table] Add parseJson() and tryParseJson() Table API expression methods - #29091
Merged
snuyanzin merged 3 commits intoSep 6, 2026
Merged
Conversation
Collaborator
twalthr
reviewed
Sep 4, 2026
raminqaf
force-pushed
the
FLINK-40545-json-parse-table-api
branch
from
September 4, 2026 11:03
0c5f5e1 to
fd8ad0d
Compare
twalthr
approved these changes
Sep 4, 2026
|
|
||
| variant: | ||
| - sql: PARSE_JSON(json_string[, allow_duplicate_keys]) | ||
| table: STRING.parseJson([BOOLEAN allowDuplicateKeys]) |
Contributor
There was a problem hiding this comment.
Suggested change
| table: STRING.parseJson([BOOLEAN allowDuplicateKeys]) | |
| table: STRING.parseJson([allowDuplicateKeys]) |
Contributor
There was a problem hiding this comment.
looks like not resolved yet
there is still a couple of places in doc with same issue, e.g.
https://github.com/apache/flink/pull/29091/changes#diff-539fb22ee6aeee4cf07230bb4155500c6680c4cc889260e2c58bfa9d63fb7de5R1353
…ression methods
PARSE_JSON and TRY_PARSE_JSON were only reachable in the Table API through generic call() invocations, unlike other JSON functions (jsonQuote(), isJson(), jsonValue(), etc.) which expose dedicated fluent methods. Add parseJson() and tryParseJson() to BaseExpressions following the existing jsonQuote() pattern, including overloads that accept the allowDuplicateKeys flag supported by the underlying SQL functions. Update the PyFlink Table API accordingly, and document both as Table API equivalents in the JSON function reference.
Existing tests that relied on call("PARSE_JSON", ...) or stayed SQL-only for lack of a Table API equivalent are updated to use the new fluent methods.
raminqaf
force-pushed
the
FLINK-40545-json-parse-table-api
branch
from
September 4, 2026 13:17
32e0705 to
1fb7119
Compare
snuyanzin
approved these changes
Sep 6, 2026
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_JSON and TRY_PARSE_JSON were only reachable from the Table API through generic
call("PARSE_JSON", ...)invocations, unlike the other JSON functions (jsonQuote(),isJson(),jsonValue(),jsonQuery(), ...), which all expose dedicated fluent methods. This pull request closes that gap by addingparseJson()andtryParseJson()to.BaseExpressions, following the existingjsonQuote()pattern, soVARIANTvalues can be produced with$("f").parseJson()instead of the genericcall()syntax.Brief change log
parseJson()andtryParseJson()toBaseExpressions(Scala's fluent API inherits these automatically since it extendsBaseExpressions)parse_json()/try_parse_json()methods to the PyFlink Table APISTRING.parseJson()/STRING.tryParseJson()) in the JSON function reference (docs/data/sql_functions.ymland the zh variant)JsonFunctionsITCaseandCastFunctionITCaseto use the new fluent methods in place ofcall("PARSE_JSON", ...)/call("TRY_PARSE_JSON", ...), including two cases hat previously stayed SQL-only for lack of a Table API equivalentVerifying this change
This change added tests and can be verified as follows:
JsonFunctionsITCasewith Table APItestResult(...)cases forparseJson()andtryParseJson(), paired with their SQL equivalentsPARSE_JSON/TRY_PARSE_JSONcast tests inCastFunctionITCaseto go through the new fluent methodsDoes this pull request potentially affect one of the following parts:
@Public(Evolving): yes(
BaseExpressionsis@PublicEvolving; two new methods added, nothing changed or removed)Checkpointing, Kubernetes/Yarn, ZooKeeper: no
Documentation
Was generative AI tooling used to co-author this PR?
Generated-by: Opus 4.8