gianm commented on a change in pull request #8744: support for array expressions in TransformSpec with ExpressionTransform URL: https://github.com/apache/incubator-druid/pull/8744#discussion_r345459910
########## File path: processing/src/main/java/org/apache/druid/segment/virtual/ExpressionSelectors.java ########## @@ -514,15 +509,45 @@ public void inspectRuntimeShape(RuntimeShapeInspector inspector) /** * Selectors are not consistent in treatment of null, [], and [null], so coerce [] to [null] */ - private static Object coerceListDimToStringArray(List val) + // suppressed because calling toArray creates Object[] instead of Long[] which makes ExprEval.bestEffortOf sad + @SuppressWarnings("SimplifyStreamApiCallChains") + public static Object coerceListToArray(List val) { - Object[] arrayVal = val.stream().map(x -> x != null ? x.toString() : x).toArray(String[]::new); - if (arrayVal.length > 0) { - return arrayVal; + if (val != null && val.size() > 0) { + Object firstElement = val.get(0); Review comment: Expressions support lists that contain nulls, right? What happens if the first element is null? Also, what happens if the first element is an Integer but later ones are Doubles? i.e. JSON `[1, 2.0]`. It may be better to examine all elements using some kind of binary type conversion rules (like long + int = long, etc). ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org