Implement canProduceBitmaps and getBitmaps for AND and OR filter operators - #19038
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enables bitmap production for composite AndFilterOperator and OrFilterOperator in pinot-core, allowing AND/OR nodes to participate directly in bitmap-based fast paths (e.g., count optimization and getFilteredDocIds) instead of falling back to doc iteration.
Changes:
- Implement
canProduceBitmaps()andgetBitmaps()forAndFilterOperatorandOrFilterOperatorby reducing each child’sBitmapCollectionand aggregating viaBufferFastAggregation.and/or. - Simplify
canOptimizeCount()in both operators to delegate tocanProduceBitmaps(). - Add unit tests covering bitmap capability and bitmap aggregation (including exclusive/inverted children and nesting), plus minor test cleanups.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| pinot-core/src/main/java/org/apache/pinot/core/operator/filter/AndFilterOperator.java | Adds bitmap capability for composite AND filters and aligns canOptimizeCount() with bitmap support. |
| pinot-core/src/main/java/org/apache/pinot/core/operator/filter/OrFilterOperator.java | Adds bitmap capability for composite OR filters and aligns canOptimizeCount() with bitmap support. |
| pinot-core/src/test/java/org/apache/pinot/core/operator/filter/AndFilterOperatorTest.java | Adds tests validating canProduceBitmaps()/getBitmaps() behavior for AND, including exclusive and nested cases. |
| pinot-core/src/test/java/org/apache/pinot/core/operator/filter/OrFilterOperatorTest.java | Adds tests validating canProduceBitmaps()/getBitmaps() behavior for OR, including exclusive and nested cases; also updates assertions/imports. |
xiangfu0
approved these changes
Jul 22, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19038 +/- ##
============================================
- Coverage 65.45% 65.44% -0.01%
Complexity 1421 1421
============================================
Files 3428 3428
Lines 216598 216608 +10
Branches 34311 34313 +2
============================================
- Hits 141778 141763 -15
- Misses 63405 63435 +30
+ Partials 11415 11410 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…ators AndFilterOperator and OrFilterOperator now override canProduceBitmaps (true when every child can produce bitmaps) and getBitmaps (intersection for AND, union for OR, reducing each child so per-child inversion is honored). canOptimizeCount now delegates to canProduceBitmaps, removing the duplicated all-children-can-produce-bitmaps loop.
Jackie-Jiang
force-pushed
the
filter-and-or-bitmaps
branch
from
July 22, 2026 06:37
ab1cbb1 to
1de9744
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements
canProduceBitmapsandgetBitmapsforAndFilterOperatorandOrFilterOperator, which previously fell back to the baseBaseFilterOperatordefaults (canProduceBitmaps()returningfalseandgetBitmaps()throwing).canProduceBitmaps()returnstrueonly when every child can produce bitmaps.getBitmaps()reduces each child'sBitmapCollection— so any per-child inversion (exclusive predicates,NOT) is materialized before aggregation — then combines them viaBufferFastAggregation.and(AND) /BufferFastAggregation.or(OR), returning a non-inverted single-bitmapBitmapCollection.canOptimizeCount()now delegates tocanProduceBitmaps()in both operators, removing the duplicated "all children can produce bitmaps" loop it previously carried.This lets composite AND/OR nodes participate directly in the bitmap-based fast paths (e.g. count optimization and
getFilteredDocIds) instead of being materialized through document iteration, and it composes recursively for nested AND/OR trees.FilterOperatorUtilsstripsMatchAllFilterOperator/EmptyFilterOperatorchildren before constructing an AND/OR, so every child of an AND/OR shares the samenumDocs, making the reduce-then-aggregate path safe.