Skip to content

Commit

Permalink
[Fix](Variant) ensure variant column finalized before reading the roo…
Browse files Browse the repository at this point in the history
…t column

Eg. segment 1 has no variant columns and fill the dst with default value, which the variant columns's root is type nothing with n rows(not finalized), then
reading segment2 with the none finalized variant column will lead to nullptr in `obj.get_root();`
  • Loading branch information
eldenmoon committed Jul 11, 2024
1 parent 84fcb73 commit a42d034
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions be/src/olap/rowset/segment_v2/column_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1601,6 +1601,9 @@ Status VariantRootColumnIterator::next_batch(size_t* n, vectorized::MutableColum
if (obj.is_null_root()) {
obj.create_root();
}
if (!obj.is_finalized()) {
obj.finalize();
}
auto root_column = obj.get_root();
RETURN_IF_ERROR(_inner_iter->next_batch(n, root_column, has_null));
obj.incr_num_rows(*n);
Expand Down Expand Up @@ -1634,6 +1637,9 @@ Status VariantRootColumnIterator::read_by_rowids(const rowid_t* rowids, const si
if (obj.is_null_root()) {
obj.create_root();
}
if (!obj.is_finalized()) {
obj.finalize();
}
auto root_column = obj.get_root();
RETURN_IF_ERROR(_inner_iter->read_by_rowids(rowids, count, root_column));
obj.incr_num_rows(count);
Expand Down

0 comments on commit a42d034

Please sign in to comment.