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

 ##########
 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:
   Not sure about how much performance effect boxing/unboxing will have, in 
this form atleast the change is on safer side and does not affect performance 
for non-sql case. 
   We can run more benchmarks in a follow up PR and change this api to return 
boxed values if the performance diff is not much. 

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

Reply via email to