This is an automated email from the ASF dual-hosted git repository.
yangsiyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 539a1a4277a [fix](topn) fix AcceptNullPredicate adding back all null
rows instead of only those in original bitmap (#60537)
539a1a4277a is described below
commit 539a1a4277a867bd5509d47d79b8af867bc41cad
Author: zzzxl <[email protected]>
AuthorDate: Fri Feb 6 17:54:04 2026 +0800
[fix](topn) fix AcceptNullPredicate adding back all null rows instead of
only those in original bitmap (#60537)
---
be/src/olap/accept_null_predicate.h | 6 +++--
be/test/olap/accept_null_predicate_test.cpp | 38 +++++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/be/src/olap/accept_null_predicate.h
b/be/src/olap/accept_null_predicate.h
index f93cdb41fc0..fb3053e09e1 100644
--- a/be/src/olap/accept_null_predicate.h
+++ b/be/src/olap/accept_null_predicate.h
@@ -69,7 +69,7 @@ public:
Status evaluate(const vectorized::IndexFieldNameAndTypePair&
name_with_type,
IndexIterator* iterator, uint32_t num_rows,
roaring::Roaring* bitmap) const override {
- RETURN_IF_ERROR(_nested->evaluate(name_with_type, iterator, num_rows,
bitmap));
+ roaring::Roaring null_rows_in_bitmap;
if (iterator != nullptr) {
bool has_null = DORIS_TRY(iterator->has_null());
if (has_null) {
@@ -77,10 +77,12 @@ public:
RETURN_IF_ERROR(iterator->read_null_bitmap(&null_bitmap_cache_handle));
auto null_bitmap = null_bitmap_cache_handle.get_bitmap();
if (null_bitmap) {
- *bitmap |= *null_bitmap;
+ null_rows_in_bitmap = *bitmap & *null_bitmap;
}
}
}
+ RETURN_IF_ERROR(_nested->evaluate(name_with_type, iterator, num_rows,
bitmap));
+ *bitmap |= null_rows_in_bitmap;
return Status::OK();
}
diff --git a/be/test/olap/accept_null_predicate_test.cpp
b/be/test/olap/accept_null_predicate_test.cpp
index edffd80b0d4..0b6e5eed983 100644
--- a/be/test/olap/accept_null_predicate_test.cpp
+++ b/be/test/olap/accept_null_predicate_test.cpp
@@ -173,6 +173,7 @@ TEST_F(AcceptNullPredicateTest, EvaluateWithNullRows) {
MockIndexIterator iterator(true, null_bitmap);
roaring::Roaring bitmap;
+ bitmap.addRange(0, 10);
vectorized::IndexFieldNameAndTypePair name_with_type = {"test_col",
nullptr};
Status status = predicate.evaluate(name_with_type, &iterator, 10, &bitmap);
@@ -214,4 +215,41 @@ TEST_F(AcceptNullPredicateTest, Clone) {
EXPECT_EQ(cloned->column_id(), 1);
}
+TEST_F(AcceptNullPredicateTest, EvaluateWithPreFilteredBitmap) {
+ auto nested_result = std::make_shared<roaring::Roaring>();
+ nested_result->add(0);
+ nested_result->add(1);
+ nested_result->add(5);
+
+ auto nested_pred = std::make_shared<MockNestedPredicate>(0, nested_result);
+ AcceptNullPredicate predicate(nested_pred);
+
+ auto null_bitmap = std::make_shared<roaring::Roaring>();
+ null_bitmap->add(2);
+ null_bitmap->add(3);
+ null_bitmap->add(7);
+ MockIndexIterator iterator(true, null_bitmap);
+
+ roaring::Roaring bitmap;
+ bitmap.add(0);
+ bitmap.add(1);
+ bitmap.add(2);
+ bitmap.add(5);
+ bitmap.add(6);
+
+ vectorized::IndexFieldNameAndTypePair name_with_type = {"test_col",
nullptr};
+
+ Status status = predicate.evaluate(name_with_type, &iterator, 10, &bitmap);
+
+ EXPECT_TRUE(status.ok());
+ EXPECT_EQ(bitmap.cardinality(), 4);
+ EXPECT_TRUE(bitmap.contains(0));
+ EXPECT_TRUE(bitmap.contains(1));
+ EXPECT_TRUE(bitmap.contains(2));
+ EXPECT_TRUE(bitmap.contains(5));
+ EXPECT_FALSE(bitmap.contains(3));
+ EXPECT_FALSE(bitmap.contains(6));
+ EXPECT_FALSE(bitmap.contains(7));
+}
+
} // namespace doris
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]