-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](inverted index) fix is null predicate for inverted index evaluate #56964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
csun5285
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the evaluation of IS NULL predicates when using inverted indexes. The issue was that IS NULL queries were returning incorrect results (0 rows) when relying on inverted index evaluation instead of the expected non-zero counts.
- Corrected the logic in
FunctionIsNull::evaluate_inverted_indexto properly handle null bitmaps - Added comprehensive regression tests to verify IS NULL and NOT (IS NOT NULL) queries work correctly with inverted indexes
- Ensured consistent results between inverted index enabled and disabled modes
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| be/src/vec/functions/is_null.h | Fixed the inverted index evaluation logic for IS NULL predicates by correcting bitmap handling |
| regression-test/suites/inverted_index_p0/test_inverted_is_null.groovy | Added comprehensive test coverage for IS NULL queries with inverted indexes |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| // null_bitmap is null bitmap | ||
| bitmap_result = segment_v2::InvertedIndexResultBitmap(null_bitmap, null_bitmap); | ||
| } | ||
| if (!index_iter->has_null()) { |
Copilot
AI
Oct 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the index has no nulls, the function returns OK without setting bitmap_result, but the caller expects a valid bitmap. This could lead to undefined behavior when bitmap_result is accessed later.
| if (!index_iter->has_null()) { | |
| if (!index_iter->has_null()) { | |
| auto empty_bitmap = std::make_shared<roaring::Roaring>(); | |
| bitmap_result = segment_v2::InvertedIndexResultBitmap(empty_bitmap, empty_bitmap); |
| segment_v2::InvertedIndexQueryCacheHandle null_bitmap_cache_handle; | ||
| RETURN_IF_ERROR(index_iter->read_null_bitmap(&null_bitmap_cache_handle)); | ||
| std::shared_ptr<roaring::Roaring> null_bitmap = null_bitmap_cache_handle.get_bitmap(); | ||
| if (!null_bitmap) { |
Copilot
AI
Oct 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the previous issue, returning OK without setting bitmap_result when null_bitmap is null could cause problems for the caller expecting a valid bitmap result.
| if (!null_bitmap) { | |
| if (!null_bitmap) { | |
| // Set bitmap_result to an empty result if null_bitmap is null | |
| auto empty_bitmap = std::make_shared<roaring::Roaring>(); | |
| bitmap_result = segment_v2::InvertedIndexResultBitmap(empty_bitmap, empty_bitmap); |
|
PR approved by anyone and no changes requested. |
ClickBench: Total hot run time: 30.08 s |
zzzxl1993
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
eldenmoon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
PR approved by at least one committer and no changes requested. |
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
|
run buildall |
TPC-DS: Total hot run time: 189941 ms |
ClickBench: Total hot run time: 30.68 s |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
eldenmoon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
PR approved by at least one committer and no changes requested. |
What problem does this PR solve?
Issue Number: close #xxx
Related PR: #50748 #56139
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)