jihoonson commented on a change in pull request #5958: Part 2 of changes for
SQL Compatible Null Handling
URL: https://github.com/apache/incubator-druid/pull/5958#discussion_r201164223
##########
File path: common/src/main/java/io/druid/math/expr/Expr.java
##########
@@ -365,15 +371,21 @@ public ExprEval eval(ObjectBinding bindings)
// Result of any Binary expressions is null if any of the argument is null.
// e.g "select null * 2 as c;" or "select null + 1 as c;" will return null
as per Standard SQL spec.
- if (NullHandling.sqlCompatible() && (leftVal.isNull() ||
rightVal.isNull())) {
+ if (NullHandling.sqlCompatible() && (leftVal.value() == null ||
rightVal.value() == null)) {
return ExprEval.of(null);
}
if (leftVal.type() == ExprType.STRING && rightVal.type() ==
ExprType.STRING) {
return evalString(leftVal.asString(), rightVal.asString());
} else if (leftVal.type() == ExprType.LONG && rightVal.type() ==
ExprType.LONG) {
+ if (NullHandling.sqlCompatible() && (leftVal.isNumericNull() ||
rightVal.isNumericNull())) {
Review comment:
Wonder why we check this here instead of changing `evalLong()` or
`evalDouble` to return a nullable `Long` or `Double`, respectively. Is this to
avoid boxing/unboxing? If so, I wonder how much it affects to the performance.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]