airborne12 opened a new pull request, #61323:
URL: https://github.com/apache/doris/pull/61323

   Cherry-pick of #61200 to branch-4.1.
   
   ### What problem does this PR solve?
   
   Issue Number: close #DORIS-24681
   
   `search('NOT msg:omega')` incorrectly includes NULL rows in the result set, 
while `NOT search('msg:omega')` correctly excludes them.
   
   **Root cause:** `ExcludeScorer` does not implement `has_null_bitmap()` / 
`get_null_bitmap()`, inheriting the `Scorer` base class defaults that always 
return `false` / `nullptr`. This caused NULL documents to be treated as TRUE 
(matching) rather than NULL, violating SQL three-valued logic where `NOT(NULL) 
= NULL`.
   
   **Fix:** Enhance `ExcludeScorer` with null bitmap support:
   - Accept a pre-collected `exclude_null` bitmap (read from index at O(1) cost)
   - Check it during `advance()`/`seek()` before the original lazy 
`is_within()` exclusion
   - Implement `has_null_bitmap()`/`get_null_bitmap()` to propagate null info
   - Plumb `binding_keys` from `function_search.cpp` through 
OccurBooleanQueryBuilder → OccurBooleanQuery → OccurBooleanWeight for proper 
null bitmap resolution
   
   ### Release note
   
   Fix search('NOT field:value') incorrectly including NULL rows by using 
null-bitmap-aware ExcludeScorer.
   
   ### Check List (For Author)
   
   - Test
       - [x] Regression test
       - [x] Unit Test
       - [x] Manual test
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to