clintropolis commented on code in PR #16093:
URL: https://github.com/apache/druid/pull/16093#discussion_r1520645193


##########
sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidRexExecutor.java:
##########
@@ -176,6 +176,17 @@ public void reduce(
               }
               literal = rexBuilder.makeLiteral(resultAsBigDecimalList, 
constExp.getType(), true);
             }
+          } else if (constExp.getType().getComponentType().getSqlTypeName() == 
SqlTypeName.BOOLEAN) {
+            List<Boolean> resultAsBooleanList = new ArrayList<>(array.length);
+            for (Object val : 
exprResult.castTo(ExpressionType.LONG_ARRAY).asArray()) {
+              final Number longVal = (Number) val;
+              if (longVal == null) {
+                resultAsBooleanList.add(null);
+              } else {
+                resultAsBooleanList.add(longVal.longValue() > 0);

Review Comment:
   nit: could use `Evals.asBoolean` here just on the off chance we ever change 
how we coerce longs into booleans in the native layer, but this is probably 
safe too



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to