branch-2.1: [Fix](JsonReader) Fix the issue where the null bitmap of the JSON reader was not initialized when the JSON path is specified as '$.’ #52211 (#52268)
Cherry-picked from #52211 Co-authored-by: lihangyu <lihangyu@selectdb.com>
This commit is contained in:
committed by
GitHub
parent
4999816ae6
commit
e923acef1b
@ -1719,6 +1719,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(),
|
||||
|
||||
@ -259,4 +259,11 @@ test k2_value
|
||||
|
||||
-- !select31 --
|
||||
789 beijing haidian
|
||||
1111 \N \N
|
||||
1111 \N \N
|
||||
|
||||
-- !select30 --
|
||||
12345 {"k1":12345,"k2":"11111","k3":111111,"k4":[11111]} {"k1":12345,"k2":"11111","k3":111111,"k4":[11111]} 111111
|
||||
12346 {"k1":12346,"k2":"22222","k4":[22222]} {"k1":12346,"k2":"22222","k4":[22222]} \N
|
||||
12347 {"k1":12347,"k3":"33333","k4":[22222]} {"k1":12347,"k3":"33333","k4":[22222]} 33333
|
||||
12348 {"k1":12348,"k3":"33333","k5":{"k51":1024,"xxxx":[11111]}} {"k1":12348,"k3":"33333","k5":{"k51":1024,"xxxx":[11111]}} 33333
|
||||
|
||||
|
||||
@ -932,4 +932,31 @@ suite("test_json_load", "p0") {
|
||||
} 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}")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user