richardstartin commented on a change in pull request #7435: URL: https://github.com/apache/pinot/pull/7435#discussion_r709877633
########## File path: pinot-core/src/main/java/org/apache/pinot/core/operator/filter/RangeIndexBasedFilterOperator.java ########## @@ -51,74 +51,84 @@ public RangeIndexBasedFilterOperator(PredicateEvaluator rangePredicateEvaluator, @Override protected FilterBlock getNextBlock() { - RangeIndexReader rangeIndexReader = (RangeIndexReader) _dataSource.getRangeIndex(); + @SuppressWarnings("unchecked") + RangeIndexReader<ImmutableRoaringBitmap> rangeIndexReader = + (RangeIndexReader<ImmutableRoaringBitmap>) _dataSource.getRangeIndex(); assert rangeIndexReader != null; + ImmutableRoaringBitmap matches; + // if the implementation cannot match the entire query exactly, it will + // yield partial matches, which need to be verified by scanning. If it + // can answer the query exactly, this will be null. + ImmutableRoaringBitmap partialMatches; int firstRangeId; int lastRangeId; if (_rangePredicateEvaluator instanceof SortedDictionaryBasedRangePredicateEvaluator) { - firstRangeId = rangeIndexReader - .findRangeId(((SortedDictionaryBasedRangePredicateEvaluator) _rangePredicateEvaluator).getStartDictId()); // NOTE: End dictionary id is exclusive in OfflineDictionaryBasedRangePredicateEvaluator. - lastRangeId = rangeIndexReader - .findRangeId(((SortedDictionaryBasedRangePredicateEvaluator) _rangePredicateEvaluator).getEndDictId() - 1); + matches = rangeIndexReader.getMatchingDocIds( + ((SortedDictionaryBasedRangePredicateEvaluator) _rangePredicateEvaluator).getStartDictId(), Review comment: There is no performance benefit to the suggested change, these values are constants in `SortedDictionaryBasedRangePredicateEvaluator` (and all other implementations used in this block of code): ```java public int getStartDictId() { return _startDictId; } public int getEndDictId() { return _endDictId; } ``` I will make the change on the basis of readability, but it's very difficult to spot bottlenecks by code review so it's better to rely on data. -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org