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


##########
processing/src/main/java/org/apache/druid/data/input/Rows.java:
##########
@@ -70,6 +71,8 @@ public static List<String> objectToStrings(final Object 
inputValue)
     } else if (inputValue instanceof byte[]) {
       // convert byte[] to base64 encoded string
       return Collections.singletonList(StringUtils.encodeBase64String((byte[]) 
inputValue));
+    } else if (inputValue instanceof Object[]) {
+      return Arrays.stream((Object[]) 
inputValue).map(String::valueOf).collect(Collectors.toList());

Review Comment:
   use `Evals::asString` instead of `String::valueOf` since the latter will 
translate `null` into `"null"` which isn't cool



##########
processing/src/main/java/org/apache/druid/segment/transform/ExpressionTransform.java:
##########
@@ -100,7 +100,11 @@ static class ExpressionRowFunction implements RowFunction
     public Object eval(final Row row)
     {
       try {
-        return expr.eval(InputBindings.forRow(row)).valueOrDefault();
+        Object result = expr.eval(InputBindings.forRow(row)).valueOrDefault();
+        if (result != null && result.getClass().isArray()) {
+          return Rows.objectToStrings(result);
+        }
+        return result;

Review Comment:
   this should not change, we want ARRAY functions to output arrays, the proper 
place to change is  
https://github.com/apache/druid/blob/master/processing/src/main/java/org/apache/druid/segment/transform/ExpressionTransform.java#L115
 which no longer needs to call `ExpressionSelectors.coerceEvalToObjectOrList`



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