druid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] leventov commented on a change in pull request #5958: Part 2 of changes for SQL Compatible Null Handling
Date Wed, 25 Jul 2018 22:05:16 GMT
leventov 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_r205276842
 
 

 ##########
 File path: common/src/main/java/io/druid/math/expr/ExprEval.java
 ##########
 @@ -245,36 +252,63 @@ public final ExprType type()
     @Override
     public final int asInt()
     {
-      if (value == null) {
+      Number number = asNumber();
+      if (number == null) {
         assert NullHandling.replaceWithDefault();
         return 0;
       }
-
-      final Integer theInt = Ints.tryParse(value);
-      assert NullHandling.replaceWithDefault() || theInt != null;
-      return theInt == null ? 0 : theInt;
+      return number.intValue();
     }
 
     @Override
     public final long asLong()
     {
-      // GuavaUtils.tryParseLong handles nulls, no need for special null handling here.
-      final Long theLong = GuavaUtils.tryParseLong(value);
-      assert NullHandling.replaceWithDefault() || theLong != null;
-      return theLong == null ? 0L : theLong;
+      Number number = asNumber();
+      if (number == null) {
+        assert NullHandling.replaceWithDefault();
 
 Review comment:
   https://github.com/apache/incubator-druid/pull/5278#discussion_r166700195 https://github.com/apache/incubator-druid/pull/5278#discussion_r167577131
https://github.com/apache/incubator-druid/pull/5278#discussion_r167579971 https://github.com/apache/incubator-druid/pull/5278#discussion_r167626205

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


Mime
View raw message