You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "nssalian (via GitHub)" <gi...@apache.org> on 2026/09/04 21:52:13 UTC
Re: [PR] Core: Order Variant metadata dictionary and object fields by UTF-8 byte order [iceberg]
nssalian commented on code in PR #17726:
URL: https://github.com/apache/iceberg/pull/17726#discussion_r3938109443
##########
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:
Making it deliberate: accept and document, no fallback. The divergence is confined to field names with supplementary code points (> U+FFFF), which I want to say are effectively nonexistent in Variant field names, and find returns only on exact match so the worst case is a false "not found," never a wrong value. I prototyped a linear-scan fallback but it adds a second lookup path for a case no one is expected to hit, so I'd rather not introduce it now.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org