Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion be/src/vec/functions/function_jsonb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ class FunctionJsonbExtractPath : public IFunction {
VectorizedUtils::update_null_map(*result_null_map, *path_null_map, path_const);
}

if (0 == simd::count_zero_num(reinterpret_cast<const int8_t*>(data_null_map->data()),
if (0 == simd::count_zero_num(reinterpret_cast<const int8_t*>(result_null_map->data()),
input_rows_count)) {
return create_all_null_result();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,8 @@ true
12 \N $.k2 \N
13 \N $.k3 \N

-- !test_all_null2 --
2 {"k1":"v31","k2":{"sub_key":1234.56}} \N \N
4 {"k1":"v31","k2":300} \N \N
6 {"k1":"v31","k2":300} \N \N

Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,38 @@ suite("test_json_exists_path") {
exception "Invalid Json Path for value: \$."
}

sql """
drop table if exists json_exists_path_test2;
"""

sql """
create table json_exists_path_test2 (
id int,
json_col json not null,
json_path string
) distributed by hash(id) buckets 1 properties("replication_num" = "1");
"""

sql """
insert into json_exists_path_test2 values
(1, '{"k1":"v31","k2":300}', '\$.k1'),
(2, '{"k1":"v31","k2":{"sub_key": 1234.56}}', null),
(3, '{"k1":"v31","k2": null}', '\$.k2'),
(4, '{"k1":"v31","k2":300}', null),
(5, '{"id": 123, "name": "doris"}', '\$.'),
(6, '{"k1":"v31","k2":300}', null),
(7, '{"k1":"v31","k2":{"sub_key": 1234.56}}', null);
"""

qt_test_all_null2 """
select
id
, json_col
, json_path
, json_exists_path(json_col, json_path)
from json_exists_path_test2 where id % 2 = 0 order by id
"""

test {
sql """
select json_exists_path(json_col_non_null, '\$.') from json_exists_path_test where id = 5;
Expand Down
Loading