maytasm commented on a change in pull request #10948:
URL: https://github.com/apache/druid/pull/10948#discussion_r597272564



##########
File path: processing/src/main/java/org/apache/druid/segment/IndexMerger.java
##########
@@ -106,6 +118,41 @@
       return null;
     }
 
+    if (isDimensionOrderingValid(indexes, orderingCandidate)) {
+      return ImmutableList.copyOf(orderingCandidate);
+    } else {
+      log.info("Indexes have incompatible dimension orders, try falling back 
on dimension ordering from ingestionSpec");
+      // Check if there is a valid dimension ordering in the ingestionSpec to 
fall back on
+      if (dimensionsSpec == null || 
CollectionUtils.isNullOrEmpty(dimensionsSpec.getDimensionNames())) {
+        log.info("Cannot fall back on dimension ordering from ingestionSpec as 
it does not exist");
+        return null;
+      }
+      List<String> candidate = dimensionsSpec.getDimensionNames();

Review comment:
       Good point. From the Guava docs, seems like "The returned list is a 
transformed view of fromList; changes to fromList will be reflected in the 
returned list and vice versa." and "To avoid lazy evaluation when the returned 
list doesn't need to be a view, copy the returned list into a new list of your 
choosing."
   
   Changed this to make a copy of the returned list from 
`dimensionsSpec.getDimensionNames()`




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

Reply via email to