richardstartin commented on code in PR #10043: URL: https://github.com/apache/pinot/pull/10043#discussion_r1063272372
########## pinot-core/src/main/java/org/apache/pinot/core/operator/filter/RangeIndexBasedFilterOperator.java: ########## @@ -131,27 +139,75 @@ public String toExplainString() { } interface RangeEvaluator { + + Set<FieldSpec.DataType> SUPPORTED_RAW_DATA_TYPES = EnumSet.of(FieldSpec.DataType.INT, + FieldSpec.DataType.LONG, FieldSpec.DataType.FLOAT, FieldSpec.DataType.DOUBLE); + + static boolean canEvaluate(PredicateEvaluator predicateEvaluator, DataSource dataSource) { + if (dataSource.getRangeIndex() != null) { + boolean datatypeSupported = dataSource.getRangeIndex().isExact() + && (predicateEvaluator.isDictionaryBased() + || SUPPORTED_RAW_DATA_TYPES.contains(predicateEvaluator.getDataType())); + switch (predicateEvaluator.getPredicateType()) { + case EQ: + return datatypeSupported && dataSource.getRangeIndex().isExact() + && predicateEvaluator instanceof EqualsPredicateEvaluatorFactory.EqualsPredicateEvaluator; + case RANGE: + return datatypeSupported && (predicateEvaluator instanceof SortedDictionaryBasedRangePredicateEvaluator + || predicateEvaluator instanceof IntRawValueBasedRangePredicateEvaluator + || predicateEvaluator instanceof LongRawValueBasedRangePredicateEvaluator + || predicateEvaluator instanceof FloatRawValueBasedRangePredicateEvaluator + || predicateEvaluator instanceof DoubleRawValueBasedRangePredicateEvaluator); + default: + } + } + return false; + } + static RangeEvaluator of(RangeIndexReader<ImmutableRoaringBitmap> rangeIndexReader, PredicateEvaluator predicateEvaluator) { - if (predicateEvaluator instanceof SortedDictionaryBasedRangePredicateEvaluator) { - return new IntRangeEvaluator(rangeIndexReader, - (SortedDictionaryBasedRangePredicateEvaluator) predicateEvaluator); + if (predicateEvaluator.isDictionaryBased()) { Review Comment: Yes, I can do that. It's going to be a longer method and harder to fit on screen but I can see benefits. -- 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