You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by dw...@apache.org on 2025/02/03 10:32:57 UTC

(flink) 03/03: [FLINK-37175][docs] Complement documentation for json function

This is an automated email from the ASF dual-hosted git repository.

dwysakowicz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 64bff89f2424784df861104e0a604cf158fe51e5
Author: Gustavo de Morais <gd...@confluent.io>
AuthorDate: Thu Jan 30 17:17:05 2025 +0100

    [FLINK-37175][docs] Complement documentation for json function
---
 docs/data/sql_functions.yml                                          | 4 ++--
 flink-python/pyflink/table/expressions.py                            | 3 ++-
 .../src/main/java/org/apache/flink/table/api/Expressions.java        | 5 +++--
 .../apache/flink/table/planner/functions/JsonFunctionsITCase.java    | 1 -
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/docs/data/sql_functions.yml b/docs/data/sql_functions.yml
index 8a6ccafd0e8..99e5de30d9f 100644
--- a/docs/data/sql_functions.yml
+++ b/docs/data/sql_functions.yml
@@ -1086,8 +1086,8 @@ json:
       This function can currently only be used within the `JSON_OBJECT` function. It allows passing 
       pre-formatted JSON strings that will be inserted directly into the resulting JSON structure 
       rather than being escaped as a string value. This allows storing nested JSON structures in a 
-      JSON_OBJECT without processing them as strings. If the value is NULL or empty, the function 
-      returns NULL.
+      JSON_OBJECT without processing them as strings, which is often useful when ingesting already 
+      formatted json data. If the value is NULL or empty, the function returns NULL.
 
       ```sql
       -- {"K":{"K2":42}}
diff --git a/flink-python/pyflink/table/expressions.py b/flink-python/pyflink/table/expressions.py
index 19935458a0d..3c531289248 100644
--- a/flink-python/pyflink/table/expressions.py
+++ b/flink-python/pyflink/table/expressions.py
@@ -778,7 +778,8 @@ def json(value) -> Expression:
     This function can currently only be used within the `JSON_OBJECT` function. It allows passing
     pre-formatted JSON strings that will be inserted directly into the resulting JSON structure
     rather than being escaped as a string value. This allows storing nested JSON structures in a
-    JSON_OBJECT without processing them as strings. If the value is NULL or empty, the function
+    JSON_OBJECT without processing them as strings, which is often useful when ingesting already
+    formatted json data. If the value is NULL or empty, the function
     returns NULL.
 
     Examples:
diff --git a/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/Expressions.java b/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/Expressions.java
index 87d7494030e..c6febab9d13 100644
--- a/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/Expressions.java
+++ b/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/Expressions.java
@@ -885,8 +885,9 @@ public final class Expressions {
      * <p>This function can currently only be used within the {@link #jsonObject(JsonOnNull,
      * Object...)} function. It allows passing pre-formatted JSON strings that will be inserted
      * directly into the resulting JSON structure rather than being escaped as a string value. This
-     * allows storing nested JSON structures in a JSON_OBJECT without processing them as strings. If
-     * the value is null or empty, the function returns {@code null}.
+     * allows storing nested JSON structures in a JSON_OBJECT without processing them as strings,
+     * which is often useful when ingesting already formatted json data. If the value is null or
+     * empty, the function returns {@code null}.
      *
      * <p>Examples:
      *
diff --git a/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/JsonFunctionsITCase.java b/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/JsonFunctionsITCase.java
index f7d85e2c44e..d4b3581f7cc 100644
--- a/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/JsonFunctionsITCase.java
+++ b/flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/JsonFunctionsITCase.java
@@ -693,7 +693,6 @@ class JsonFunctionsITCase extends BuiltInFunctionTestBase {
                                 STRING().notNull()));
     }
 
-    // Test with alias?? using str$1
     private static List<TestSetSpec> jsonSpec() {
         return Arrays.asList(
                 TestSetSpec.forFunction(BuiltInFunctionDefinitions.JSON_OBJECT)