zhtaoxiang commented on code in PR #11478:
URL: https://github.com/apache/pinot/pull/11478#discussion_r1313238763
##########
pinot-core/src/main/java/org/apache/pinot/core/query/optimizer/filter/NumericalFilterOptimizer.java:
##########
@@ -334,14 +334,12 @@ private static Expression
rewriteRangeExpression(Expression range, FilterKind ki
// Literal value is less than the bounds of LONG.
return getExpressionFromBoolean(
kind == FilterKind.GREATER_THAN || kind ==
FilterKind.GREATER_THAN_OR_EQUAL);
- } else {
- int comparison = Double.compare(actual, converted);
- // Rewrite range operator
- rewriteRangeOperator(range, kind, comparison);
-
- // Rewrite range literal
- rhs.getLiteral().setDoubleValue(converted);
}
+ // Do not rewrite range operator since double has higher precision
than float
+ // If we do, we may introduce problems.
+ // For example, in the previous logic, "> 0.5" will be converted
into ">= 0.05000000074505806". When the
+ // query reaches a server, the server will convert it to ">= 0.5"
in
Review Comment:
The reason is the query received by the server side is `CAST(column,
'DOUBLE')`, when the server tries to covert float to double, the value becomes
different.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]