You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "raminqaf (via GitHub)" <gi...@apache.org> on 2026/09/03 16:13:03 UTC

[PR] [FLINK-40545][table] Add parseJson() and tryParseJson() Table API expression methods [flink]

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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-40545][table] Add parseJson() and tryParseJson() Table API expression methods [flink]

Posted by "twalthr (via GitHub)" <gi...@apache.org>.
twalthr commented on code in PR #29091:
URL: https://github.com/apache/flink/pull/29091#discussion_r3932642682


##########
docs/data/sql_functions.yml:
##########
@@ -1338,17 +1338,19 @@ json:
 
 variant:
   - sql: PARSE_JSON(json_string[, allow_duplicate_keys])
+    table: STRING.parseJson()

Review Comment:
   no allow duplicate keys?



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-40545][table] Add parseJson() and tryParseJson() Table API expression methods [flink]

Posted by "raminqaf (via GitHub)" <gi...@apache.org>.
raminqaf commented on code in PR #29091:
URL: https://github.com/apache/flink/pull/29091#discussion_r3933373565


##########
docs/data/sql_functions.yml:
##########
@@ -1338,17 +1338,19 @@ json:
 
 variant:
   - sql: PARSE_JSON(json_string[, allow_duplicate_keys])
+    table: STRING.parseJson()

Review Comment:
   Wow thanks! 😅  I don't know how I missed this!



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-40545][table] Add parseJson() and tryParseJson() Table API expression methods [flink]

Posted by "twalthr (via GitHub)" <gi...@apache.org>.
twalthr commented on code in PR #29091:
URL: https://github.com/apache/flink/pull/29091#discussion_r3933402907


##########
docs/data/sql_functions_zh.yml:
##########
@@ -1423,6 +1423,7 @@ json:
 
 variant:
   - sql: PARSE_JSON(json_string[, allow_duplicate_keys])
+    table: STRING.parseJson([BOOLEAN allowDuplicateKeys])

Review Comment:
   ```suggestion
       table: STRING.parseJson([allowDuplicateKeys])
   ```



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-40545][table] Add parseJson() and tryParseJson() Table API expression methods [flink]

Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #29091:
URL: https://github.com/apache/flink/pull/29091#issuecomment-5528799401

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "0c5f5e13897e27ed8588898efe212c364cb251f5",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "0c5f5e13897e27ed8588898efe212c364cb251f5",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 0c5f5e13897e27ed8588898efe212c364cb251f5 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-40545][table] Add parseJson() and tryParseJson() Table API expression methods [flink]

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin merged PR #29091:
URL: https://github.com/apache/flink/pull/29091


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-40545][table] Add parseJson() and tryParseJson() Table API expression methods [flink]

Posted by "raminqaf (via GitHub)" <gi...@apache.org>.
raminqaf commented on code in PR #29091:
URL: https://github.com/apache/flink/pull/29091#discussion_r3933426830


##########
docs/data/sql_functions_zh.yml:
##########
@@ -1423,6 +1423,7 @@ json:
 
 variant:
   - sql: PARSE_JSON(json_string[, allow_duplicate_keys])
+    table: STRING.parseJson([BOOLEAN allowDuplicateKeys])

Review Comment:
   Addressed



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-40545][table] Add parseJson() and tryParseJson() Table API expression methods [flink]

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #29091:
URL: https://github.com/apache/flink/pull/29091#discussion_r3941168627


##########
docs/data/sql_functions_zh.yml:
##########
@@ -1423,6 +1423,7 @@ json:
 
 variant:
   - sql: PARSE_JSON(json_string[, allow_duplicate_keys])
+    table: STRING.parseJson([BOOLEAN allowDuplicateKeys])

Review 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



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-40545][table] Add parseJson() and tryParseJson() Table API expression methods [flink]

Posted by "raminqaf (via GitHub)" <gi...@apache.org>.
raminqaf commented on code in PR #29091:
URL: https://github.com/apache/flink/pull/29091#discussion_r3943225042


##########
docs/data/sql_functions_zh.yml:
##########
@@ -1423,6 +1423,7 @@ json:
 
 variant:
   - sql: PARSE_JSON(json_string[, allow_duplicate_keys])
+    table: STRING.parseJson([BOOLEAN allowDuplicateKeys])

Review Comment:
   @snuyanzin Addressed



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org