Skip to content

Commit

Permalink
[Fix](Branch-2.1) fix not null variant will lost null bitmap
Browse files Browse the repository at this point in the history
  • Loading branch information
eldenmoon committed Oct 28, 2024
1 parent c387816 commit 1d93e0b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
7 changes: 7 additions & 0 deletions be/src/olap/rowset/segment_v2/hierarchical_data_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ class HierarchicalDataReader : public ColumnIterator {
.get_nested_column())
.clear_subcolumns_data();
} else {
if (dst->is_nullable()) {
// No nullable info exist in hirearchical data, fill nullmap with all none null
vectorized::ColumnUInt8& dst_null_map =
assert_cast<vectorized::ColumnNullable&>(*dst).get_null_map_column();
auto fake_nullable_column = vectorized::ColumnUInt8::create(nrows, 0);
dst_null_map.insert_range_from(*fake_nullable_column, 0, nrows);
}
vectorized::ColumnObject& root_column =
assert_cast<vectorized::ColumnObject&>(*_root_reader->column);
root_column.clear_subcolumns_data();
Expand Down
18 changes: 18 additions & 0 deletions regression-test/suites/variant_p0/variant_hirachinal.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,22 @@ suite("regression_test_variant_hirachinal", "variant_type"){
qt_sql "select * from ${table_name} order by k limit 10"
qt_sql "select v['c'] from ${table_name} where k = -3 or k = -2"
qt_sql "select v['b'] from ${table_name} where k = -3 or k = -2"

table_name = "var_rs_not_null"
sql "DROP TABLE IF EXISTS ${table_name}"
sql """
CREATE TABLE IF NOT EXISTS ${table_name} (
k bigint,
v variant not null
)
DUPLICATE KEY(`k`)
DISTRIBUTED BY HASH(k) BUCKETS 1
properties("replication_num" = "1", "disable_auto_compaction" = "false");
"""
sql """insert into ${table_name} values (-3, '{"a" : 1, "b" : 1.5, "c" : [1, 2, 3]}')"""
sql """insert into ${table_name} select -2, '{"a": 11245, "b" : [123, {"xx" : 1}], "c" : {"c" : 456, "d" : "null", "e" : 7.111}}' as json_str
union all select -1, '{"a": 1123}' as json_str union all select *, '{"a" : 1234, "xxxx" : "kaana"}' as json_str from numbers("number" = "4096") limit 4096 ;"""
sql "select * from ${table_name} order by k + 1 limit 10"
sql "select v['c'] from ${table_name} where k = -3 or k = -2"
sql "select v['b'] from ${table_name} where k = -3 or k = -2"
}

0 comments on commit 1d93e0b

Please sign in to comment.