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


##########
processing/src/main/java/org/apache/druid/segment/CursorBuildSpec.java:
##########
@@ -234,8 +237,18 @@ public boolean isCompatibleOrdering(List<OrderBy> ordering)
     if (ordering.size() < preferredOrdering.size()) {
       return false;
     }
-    for (int i = 0; i < preferredOrdering.size(); i++) {
-      if (!ordering.get(i).equals(preferredOrdering.get(i))) {
+
+    boolean exactMatch = ordering.get(0).equals(preferredOrdering.get(0));
+    if (!exactMatch && 
!ordering.get(0).equals(preferredOrdering.get(0).reverse())) {

Review Comment:
   it might be nicer to do this without making additional `OrderBy` objects 
that `reverse` is going to be making since this is going to happen for every 
projection match of every segment being processed (to keep the garbage 
collector from having to do work); i think we could just check inline if the 
direction is same or reversed, and just keep counters and make sure either the 
same direction counter or reverse counter are the same as the total length (and 
bail early if neither count matches the processed count)



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