imply-cheddar commented on code in PR #12552:
URL: https://github.com/apache/druid/pull/12552#discussion_r878939325
##########
processing/src/main/java/org/apache/druid/segment/DimensionHandlerUtils.java:
##########
@@ -402,7 +424,14 @@ public static ComparableList convertToList(Object obj)
if (obj instanceof ComparableList) {
return (ComparableList) obj;
}
- throw new ISE("Unable to convert type %s to %s", obj.getClass().getName(),
ComparableList.class.getName());
+ if (obj instanceof Object[]) {
+ List<T> delegateList = new ArrayList<T>();
+ for (Object eachObj : (Object[]) obj) {
+ delegateList.add(convertFunction.apply(eachObj));
Review Comment:
This code is not symmetrical with the `List<>` case above. Is there a
specific reason why objects need conversion when they are an array and not when
they are a `List<>`? It seems like they should generally be the same code
path, so if `return new ComparableList((List) obj);` is correct for List, why
can it not also be correct for the Object[] case? Or, vice-versa, if the
converted form is correct, then I think the `List<>` case above needs update.
Do we know which code path tickles the `List<>` case above? Is there a test
that covers it?
--
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]