Jackie-Jiang commented on code in PR #14163:
URL: https://github.com/apache/pinot/pull/14163#discussion_r1794325073


##########
pinot-core/src/main/java/org/apache/pinot/core/query/optimizer/filter/NumericalFilterOptimizer.java:
##########
@@ -346,6 +365,156 @@ private static Expression 
rewriteRangeExpression(Expression range, FilterKind ki
     return range;
   }
 
+  /**
+   * Rewrite expressions of the form "column BETWEEN lower AND upper" to 
ensure that lower and upper bounds are the same
+   * datatype as the column (or can be cast to the same datatype in the 
server).
+   */
+  private static Expression rewriteBetweenExpression(Expression between, 
DataType dataType) {
+    List<Expression> operands = between.getFunctionCall().getOperands();
+    Expression lower = operands.get(1);
+    Expression upper = operands.get(2);
+
+    if (lower.isSetLiteral()) {
+      switch (lower.getLiteral().getSetField()) {
+        case LONG_VALUE: {
+          long actual = lower.getLiteral().getLongValue();
+          // Other data types can be converted on the server side.

Review Comment:
   Thanks for the detailed explanation. Ideally we want the behavior to be 
consistent across all range filters. Given the difficulties and the scope of 
this PR, let's add a TODO to revisit in the future



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