richardstartin commented on code in PR #10043:
URL: https://github.com/apache/pinot/pull/10043#discussion_r1063363939


##########
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()) {
+        if (predicateEvaluator instanceof 
EqualsPredicateEvaluatorFactory.EqualsPredicateEvaluator) {
+          return new IntPointEvaluator(rangeIndexReader,
+                  (EqualsPredicateEvaluatorFactory.EqualsPredicateEvaluator) 
predicateEvaluator);

Review Comment:
   However, I have had to move the inner classes up to top level to make the 
class names shorter, otherwise we run into a particular case where the 
automatic formatting produces lines longer than 120 characters and gets 
rejected by checkstyle 🤦🏻 



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

Reply via email to