maytasm commented on a change in pull request #10014:
URL: https://github.com/apache/druid/pull/10014#discussion_r440534184
##########
File path: core/src/main/java/org/apache/druid/math/expr/Function.java
##########
@@ -737,7 +745,12 @@ private ExprEval eval(ExprEval param, int scale)
if (param.type() == ExprType.LONG) {
return ExprEval.of(BigDecimal.valueOf(param.asLong()).setScale(scale,
RoundingMode.HALF_UP).longValue());
} else if (param.type() == ExprType.DOUBLE) {
- return
ExprEval.of(BigDecimal.valueOf(param.asDouble()).setScale(scale,
RoundingMode.HALF_UP).doubleValue());
+ double val = param.asDouble();
+ if (Double.isNaN(val) || val == Double.POSITIVE_INFINITY || val ==
Double.NEGATIVE_INFINITY) {
+ // This is the behavior of Math.round()
+ return ExprEval.of(0L);
Review comment:
Sounds good to me.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]