Jackie-Jiang commented on a change in pull request #7435: URL: https://github.com/apache/pinot/pull/7435#discussion_r709645668
########## 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: Both performance and readability. What I mean is to put `((SortedDictionaryBasedRangePredicateEvaluator) _rangePredicateEvaluator).getStartDictId()` and `((SortedDictionaryBasedRangePredicateEvaluator) _rangePredicateEvaluator).getEndDictId() - 1` into local variables instead of calculating them twice -- 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