Jackie-Jiang commented on code in PR #18588:
URL: https://github.com/apache/pinot/pull/18588#discussion_r3319261324
##########
pinot-core/src/main/java/org/apache/pinot/core/operator/query/InvertedIndexDistinctOperator.java:
##########
@@ -204,59 +198,15 @@ private boolean shouldUseBitmapInvertedIndex(int
filteredDocCount) {
return (double) dictionaryCardinality * costRatio <= filteredDocCount;
}
- static final class FilterPreparation {
- @Nullable
- private final ImmutableRoaringBitmap _filteredDocIds;
- @Nullable
- private final Integer _filteredDocCount;
-
- private FilterPreparation(@Nullable ImmutableRoaringBitmap filteredDocIds,
@Nullable Integer filteredDocCount) {
- _filteredDocIds = filteredDocIds;
- _filteredDocCount = filteredDocCount;
- }
-
- @Nullable
- ImmutableRoaringBitmap getFilteredDocIds() {
- return _filteredDocIds;
- }
-
- @Nullable
- Integer getFilteredDocCount() {
- return _filteredDocCount;
- }
- }
-
- FilterPreparation prepareBitmapPathInput() {
- int totalDocs = _indexSegment.getSegmentMetadata().getTotalDocs();
- if (_filterOperator.isResultMatchingAll()) {
- return new FilterPreparation(null, totalDocs);
- }
- if (_filterOperator.isResultEmpty()) {
- return new FilterPreparation(new MutableRoaringBitmap(), 0);
- }
- // Prefer the cheaper exact count when available so scan fallback does not
pay eager bitmap materialization.
- if (_filterOperator.canOptimizeCount()) {
Review Comment:
This reduces the repeated bitmap computation on happy path, which should be
majority of the cases.
--
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]