This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.1 by this push:
new 37088d382cc branch-3.1: [fix](variant) Compatibility error when the
sparse column is empty (#55817)
37088d382cc is described below
commit 37088d382ccdd92a14efea8efb3af2ff5c5a1762
Author: Sun Chenyang <[email protected]>
AuthorDate: Thu Sep 11 10:37:35 2025 +0800
branch-3.1: [fix](variant) Compatibility error when the sparse column is
empty (#55817)
### What problem does this PR solve?
In master #55127, the compaction process was made compatible with both
the new and old variants, while in 3.1 a defensive strategy was used to
prevent errors from occurring.
---
be/src/olap/rowset/segment_v2/variant/variant_column_reader.cpp | 5 +++++
.../olap/rowset/segment_v2/variant_column_writer_reader_test.cpp | 8 ++++++++
2 files changed, 13 insertions(+)
diff --git a/be/src/olap/rowset/segment_v2/variant/variant_column_reader.cpp
b/be/src/olap/rowset/segment_v2/variant/variant_column_reader.cpp
index f9a2b21958e..f4a1431bcfe 100644
--- a/be/src/olap/rowset/segment_v2/variant/variant_column_reader.cpp
+++ b/be/src/olap/rowset/segment_v2/variant/variant_column_reader.cpp
@@ -236,6 +236,11 @@ Status
VariantColumnReader::_new_iterator_with_flat_leaves(ColumnIteratorUPtr* i
target_col.has_path_info() ?
_subcolumns_meta_info->find_leaf(relative_path) : nullptr;
if (!node) {
if (relative_path.get_path() == SPARSE_COLUMN_PATH) {
+ if (_sparse_column_reader == nullptr) {
+ return Status::InternalError(
+ "Sparse column reader is not initialize, variant
column is: {}",
+ target_col.path_info_ptr()->get_path());
+ }
// read sparse column and filter extracted columns in
subcolumn_path_map
std::unique_ptr<ColumnIterator> inner_iter;
RETURN_IF_ERROR(_sparse_column_reader->new_iterator(&inner_iter,
nullptr));
diff --git
a/be/test/olap/rowset/segment_v2/variant_column_writer_reader_test.cpp
b/be/test/olap/rowset/segment_v2/variant_column_writer_reader_test.cpp
index 13ca9ebf4ab..117fc0579b5 100644
--- a/be/test/olap/rowset/segment_v2/variant_column_writer_reader_test.cpp
+++ b/be/test/olap/rowset/segment_v2/variant_column_writer_reader_test.cpp
@@ -715,6 +715,14 @@ TEST_F(VariantColumnWriterReaderTest,
test_write_data_normal) {
EXPECT_TRUE(st.ok()) << st.msg();
EXPECT_TRUE(assert_cast<DefaultValueColumnIterator*>(it7.get()) !=
nullptr);
EXPECT_TRUE(io::global_local_filesystem()->delete_directory(_tablet->tablet_path()).ok());
+
+ // 20. check sparse column reader is nullptr
+ ColumnIteratorUPtr it_error;
+ variant_column_reader->_sparse_column_reader = nullptr;
+ st = variant_column_reader->new_iterator(&it_error, &sparse_column,
&storage_read_opts,
+ &column_reader_cache);
+ EXPECT_FALSE(st.ok()) << st.msg();
+ EXPECT_TRUE(it_error == nullptr);
}
TEST_F(VariantColumnWriterReaderTest, test_write_data_advanced) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]