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

dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new b4e65e72741 branch-3.0: [Fix](JsonReader) Fix the issue where the null 
bitmap of the JSON reader was not initialized when the JSON path is specified 
as '$.’ #52211 (#52267)
b4e65e72741 is described below

commit b4e65e72741151a1636c1aca338b06c746317383
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Jun 26 10:17:59 2025 +0800

    branch-3.0: [Fix](JsonReader) Fix the issue where the null bitmap of the 
JSON reader was not initialized when the JSON path is specified as '$.’ #52211 
(#52267)
    
    Cherry-picked from #52211
    
    Co-authored-by: lihangyu <[email protected]>
---
 be/src/vec/exec/format/json/new_json_reader.cpp    |   1 +
 .../data/load_p0/stream_load/test_json_load.out    | Bin 4666 -> 5107 bytes
 .../load_p0/stream_load/test_json_load.groovy      |  27 +++++++++++++++++++++
 3 files changed, 28 insertions(+)

diff --git a/be/src/vec/exec/format/json/new_json_reader.cpp 
b/be/src/vec/exec/format/json/new_json_reader.cpp
index 37ab5041216..c8969c6d4c3 100644
--- a/be/src/vec/exec/format/json/new_json_reader.cpp
+++ b/be/src/vec/exec/format/json/new_json_reader.cpp
@@ -2018,6 +2018,7 @@ Status NewJsonReader::_simdjson_write_columns_by_jsonpath(
             if (slot_desc->is_nullable()) {
                 nullable_column = assert_cast<ColumnNullable*>(column_ptr);
                 target_column_ptr = &nullable_column->get_nested_column();
+                nullable_column->get_null_map_data().push_back(0);
             }
             auto* column_string = 
assert_cast<ColumnString*>(target_column_ptr);
             
column_string->insert_data(_simdjson_ondemand_padding_buffer.data(),
diff --git a/regression-test/data/load_p0/stream_load/test_json_load.out 
b/regression-test/data/load_p0/stream_load/test_json_load.out
index 1d6777bb21e..3ef9ecb5be9 100644
Binary files a/regression-test/data/load_p0/stream_load/test_json_load.out and 
b/regression-test/data/load_p0/stream_load/test_json_load.out differ
diff --git a/regression-test/suites/load_p0/stream_load/test_json_load.groovy 
b/regression-test/suites/load_p0/stream_load/test_json_load.groovy
index 1042b5a3d71..cbecb831cfc 100644
--- a/regression-test/suites/load_p0/stream_load/test_json_load.groovy
+++ b/regression-test/suites/load_p0/stream_load/test_json_load.groovy
@@ -932,4 +932,31 @@ suite("test_json_load", "p0,nonConcurrent") {
     } finally {
         // try_sql("DROP TABLE IF EXISTS ${testTable}")
     }
+
+    // support read "$."  as root with json type
+    try {
+        sql "DROP TABLE IF EXISTS ${testTable}"
+        sql """CREATE TABLE IF NOT EXISTS ${testTable} 
+            (
+                `k1` varchar(1024) NULL,
+                `k2` json NULL,
+                `k3` json NULL,
+                `k4` json NULL
+            )
+            DUPLICATE KEY(`k1`)
+            COMMENT ''
+            DISTRIBUTED BY RANDOM BUCKETS 1
+            PROPERTIES (
+            "replication_allocation" = "tag.location.default: 1"
+            );"""
+
+        load_json_data.call("${testTable}", "${testTable}_case30", 'false', 
'true', 'json', '', '[\"$.k1\",\"$.\", \"$.\", \"$.k3\"]',
+                             '', '', '', 'test_read_root_path.json')
+        
+        sql "sync"
+        qt_select30 "select * from ${testTable} order by k1"
+
+    } finally {
+        // try_sql("DROP TABLE IF EXISTS ${testTable}")
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to