[fix](inverted index) Fix NULL bitmap handling in MATCH OR queries#56699
[fix](inverted index) Fix NULL bitmap handling in MATCH OR queries#56699airborne12 merged 2 commits intoapache:masterfrom
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
TPC-DS: Total hot run time: 188685 ms |
ClickBench: Total hot run time: 30.12 s |
|
run buildall |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a critical bug in NULL bitmap handling for MATCH OR queries in the inverted index system. The bug was causing incorrect boolean logic evaluation when combining TRUE and NULL values in OR operations.
- Fixed the
InvertedIndexResultBitmap::operator|=()method to properly implement SQL three-valued logic for OR operations - Added comprehensive unit tests to verify correct NULL handling in various OR scenarios
- Added regression tests to ensure MATCH OR queries with NULL values return the correct results
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| be/src/olap/rowset/segment_v2/inverted_index_reader.h | Core fix for NULL bitmap handling in OR operations using proper three-valued logic |
| be/test/olap/rowset/segment_v2/inverted_index_reader_test.cpp | Unit tests covering all cases of OR operations with NULL values |
| regression-test/suites/inverted_index_p0/test_match_or_null_semantics.groovy | Integration tests verifying MATCH OR queries work correctly with NULL values |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| WHERE title MATCH_ALL 'Philosophy' OR content MATCH_ALL 'Disney+ Hotstar' | ||
| """ | ||
|
|
||
| assertEquals(16, test1[0][0], "MATCH should return 16 rows (15 with title match + 1 with content match)") |
There was a problem hiding this comment.
Fixed typo in error message: 'recieve' should be 'receive'.
| for (uint32_t i = 0; i < 15; ++i) { | ||
| EXPECT_TRUE(bitmap_field1.get_data_bitmap()->contains(i)) | ||
| << "Row " << i << " should be TRUE"; | ||
| EXPECT_FALSE(bitmap_field1.get_null_bitmap()->contains(i)) | ||
| << "Row " << i << " should not be NULL"; | ||
| } |
There was a problem hiding this comment.
The magic number 15 is used without explanation. Consider extracting it to a named constant like NUM_MATCHING_ROWS or adding a comment explaining why 15 rows are expected.
ClickBench: Total hot run time: 30.06 s |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
…pache#56699) Related PR: apache#56139 Problem Summary: This PR fixes a bug in NULL bitmap handling for MATCH OR queries in inverted index query. The bug was causing incorrect boolean logic evaluation when combining TRUE and NULL values in OR operations.
…pache#56699) Related PR: apache#56139 Problem Summary: This PR fixes a bug in NULL bitmap handling for MATCH OR queries in inverted index query. The bug was causing incorrect boolean logic evaluation when combining TRUE and NULL values in OR operations.
What problem does this PR solve?
Issue Number: close #xxx
Related PR: #56139
Problem Summary:
This PR fixes a bug in NULL bitmap handling for MATCH OR queries in inverted index query. The bug was causing incorrect boolean logic evaluation when combining TRUE and NULL values in OR operations.
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)