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


##########
processing/src/main/java/org/apache/druid/segment/data/FrontCodedIndexedWriter.java:
##########
@@ -337,15 +340,7 @@ public static int unsignedCompare(
     if (b2 == null) {
       return 1;
     }
-    final int commonLength = Math.min(b1.length, b2.length);
-
-    for (int i = 0; i < commonLength; i++) {
-      final int cmp = FrontCodedIndexed.unsignedByteCompare(b1[i], b2[i]);
-      if (cmp != 0) {
-        return cmp;
-      }
-    }
 
-    return Integer.compare(b1.length, b2.length);
+    return StringUtils.compareUtf8(b1, b2);

Review Comment:
   We could use the two strings from the job that stumbled onto this issue
   <img width="1020" alt="Screen Shot 2022-11-10 at 4 43 39 PM" 
src="https://user-images.githubusercontent.com/1577461/202015335-662b7be2-348f-4d80-af8e-5a1845b382a7.png";>
   
   ```
       final String s1 = "(請參見已被刪除版本)";
       final String s2 = "\uD83D\uDCA9";
   ```
   
   which could be added to this test 
https://github.com/apache/druid/blob/master/processing/src/test/java/org/apache/druid/segment/data/FrontCodedIndexedTest.java#L241
 though I think the order will be reverse from that error since it was using 
the unsigned comparator to check things there.



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