raminqaf opened a new pull request, #29091:
URL: https://github.com/apache/flink/pull/29091
## 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 adding
`parseJson()` and `tryParseJson()` to. `BaseExpressions`, following the
existing `jsonQuote()` pattern, so `VARIANT` values can be produced with
`$("f").parseJson()` instead of the generic `call()` syntax.
## Brief change log
- Added `parseJson()` and `tryParseJson()` to `BaseExpressions` (Scala's
fluent API inherits these automatically since it extends `BaseExpressions`)
- Added the matching `parse_json()` / `try_parse_json()` methods to the
PyFlink Table API
- Documented both as Table API equivalents (`STRING.parseJson()` /
`STRING.tryParseJson()`) in the JSON function reference
(`docs/data/sql_functions.yml` and the zh variant)
- Updated `JsonFunctionsITCase` and `CastFunctionITCase` to use the new
fluent methods in place of `call("PARSE_JSON", ...)` / `call("TRY_PARSE_JSON",
...)`, including two cases hat previously stayed SQL-only for lack of a Table
API equivalent
## Verifying this change
This change added tests and can be verified as follows:
- Extended `JsonFunctionsITCase` with Table API `testResult(...)` cases
for `parseJson()` and `tryParseJson()`, paired with their SQL equivalents
- Converted existing `PARSE_JSON`/`TRY_PARSE_JSON` cast tests in
`CastFunctionITCase` to go through the new fluent methods
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): no
- The public API, i.e., is any changed class annotated with
`@Public(Evolving)`: yes
(`BaseExpressions` is `@PublicEvolving`; two new methods added, nothing
changed or removed)
- The serializers: no
- The runtime per-record code paths (performance sensitive): no
- Anything that affects deployment or recovery: JobManager (and its
components),
Checkpointing, Kubernetes/Yarn, ZooKeeper: no
- The S3 file system connector: no
## Documentation
- Does this pull request introduce a new feature? yes
- If yes, how is the feature documented? docs / JavaDocs
---
##### Was generative AI tooling used to co-author this PR?
<!--
If generative AI tooling has been used in the process of authoring this PR,
please
change the checkbox below to `[X]` and replace the placeholder in the
"Generated-by"
line with the tool name and version. Otherwise remove the "Generated-by"
line.
See the ASF Generative Tooling Guidance for details:
https://www.apache.org/legal/generative-tooling.html
You are responsible for the quality and correctness of every change in this
PR
regardless of the tooling used. Low-effort AI-generated PRs will be closed.
See
AGENTS.md for the full guidance.
-->
- [X] Yes (please specify the tool below)
Generated-by: Opus 4.8
--
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]