You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/05/07 00:40:13 UTC

[GitHub] [druid] jihoonson commented on a change in pull request #11185: fix bug with aggregator expressions on realtime index with string columns always producing 0 values

jihoonson commented on a change in pull request #11185:
URL: https://github.com/apache/druid/pull/11185#discussion_r627848046



##########
File path: core/src/main/java/org/apache/druid/math/expr/ExprEval.java
##########
@@ -1148,6 +1283,66 @@ public ExprType type()
       return ExprType.STRING_ARRAY;
     }
 
+    @Override
+    public boolean isNumericNull()
+    {
+      if (value != null && value.length == 1) {
+        return computeNumber(value[0]) == null;

Review comment:
       `computeNumber` seems expensive. Since the caller pattern is likely calling this and then one of `asX()` method below, should we cache the result?

##########
File path: core/src/main/java/org/apache/druid/math/expr/ExprEval.java
##########
@@ -1025,6 +1034,54 @@ public ExprType type()
       return ExprType.LONG_ARRAY;
     }
 
+    @Override
+    public int asInt()
+    {
+      if (value != null && value.length == 1) {
+        if (value[0] == null) {

Review comment:
       nit: you can use `isNumericNull()`.




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



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