xiangfu0 commented on code in PR #17872:
URL: https://github.com/apache/pinot/pull/17872#discussion_r3036331557


##########
pinot-core/src/main/java/org/apache/pinot/core/operator/filter/BaseFilterOperator.java:
##########
@@ -82,6 +87,56 @@ public BitmapCollection getBitmaps() {
     throw new UnsupportedOperationException();
   }
 
+  /**
+   * Exact filtered docIds for the operator. {@code null} indicates match-all.
+   */
+  public static final class FilteredDocIds {
+    @Nullable
+    private final ImmutableRoaringBitmap _docIds;
+    private final long _numEntriesScannedInFilter;
+
+    private FilteredDocIds(@Nullable ImmutableRoaringBitmap docIds, long 
numEntriesScannedInFilter) {
+      _docIds = docIds;
+      _numEntriesScannedInFilter = numEntriesScannedInFilter;
+    }
+
+    @Nullable
+    public ImmutableRoaringBitmap getDocIds() {
+      return _docIds;
+    }
+
+    public long getNumEntriesScannedInFilter() {
+      return _numEntriesScannedInFilter;
+    }
+  }
+
+  /**
+   * Returns the exact filtered docIds for the operator. Implementations that 
cannot produce a bitmap directly are
+   * materialized once through the filter operator itself so callers can reuse 
the same primitive.
+   */
+  public FilteredDocIds getFilteredDocIds() {

Review Comment:
   Implemented. `BaseFilterOperator#getFilteredDocIds()` now memoizes the 
computed `FilteredDocIds`, so repeated callers reuse the same exact 
bitmap/scanned-entry result instead of rescanning or rebuilding it.



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