nssalian commented on code in PR #17726:
URL: https://github.com/apache/iceberg/pull/17726#discussion_r3839006602


##########
api/src/main/java/org/apache/iceberg/variants/VariantUtil.java:
##########
@@ -99,13 +100,13 @@ static String readString(ByteBuffer buffer, int offset, 
int length) {
     }
   }
 
-  static <T extends Comparable<T>> int find(int size, T key, Function<Integer, 
T> resolve) {
+  static int find(int size, String key, Function<Integer, String> resolve) {
     int low = 0;
     int high = size - 1;
     while (low <= high) {
       int mid = (low + high) >>> 1;
-      T value = resolve.apply(mid);
-      int cmp = key.compareTo(value);
+      String value = resolve.apply(mid);
+      int cmp = Comparators.charSequences().compare(key, value);

Review Comment:
   lookups can miss on files written before this change, but only for field 
names with code points above U+FFFF (ASCII/BMP are unaffected). find only 
returns on an exact match, so a wrong-order search gives a false "not found," 
never a wrong field. I'm going to add a linear-scan fallback on a binary-search 
miss in SerializedMetadata.id and SerializedObject.get so we are correct for 
any legacy ordering.



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