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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]