yashmayya opened a new pull request, #14487:
URL: https://github.com/apache/pinot/pull/14487

   - Fixes https://github.com/apache/pinot/issues/14486.
   - The existing API incorrectly calculates `n(b1 ∪ b2')` as `numDocs - n(b2) 
- n(b1 ∩ b2)`. It should instead be `numDocs - n(b2) + n(b1 ∩ b2)`. The 
following Venn diagram clearly demonstrates the issue:
   
![image](https://github.com/user-attachments/assets/619e2f3b-9b03-4606-b231-86814a97d75e)
   - There was a unit test in `BitmapCollectionTest` that covered this case but 
the unit test itself was also buggy unfortunately. It combines a non-inverted 
bitmap `[0, 5]` with an inverted bitmap `[0, 4]` (i.e., bitmap `[1, 2, 3, 5, 6, 
7, 8, 9]`) which should result in bitmap `[0, 1, 2, 3, 5, 6, 7, 8, 9]` - i.e., 
cardinality of 9 (but the test's expectation is 7).
   - The existing logic for `n(b1' ∪ b2)` is correct however, and the existing 
unit test combining the inverted bitmap `[0, 5]` with a non-inverted bitmap 
`[0, 4]` does have an expected cardinality of 9.
   - This patch also adds a small integration test with the original generated 
query that caught this issue in a CI run.


-- 
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