aihuaxu commented on code in PR #13284: URL: https://github.com/apache/iceberg/pull/13284#discussion_r2187652979
########## core/src/main/java/org/apache/iceberg/variants/PrimitiveWrapper.java: ########## @@ -53,6 +53,7 @@ class PrimitiveWrapper<T> implements VariantPrimitive<T> { private static final byte TIMESTAMPNTZ_NANOS_HEADER = VariantUtil.primitiveHeader(Primitives.TYPE_TIMESTAMPNTZ_NANOS); private static final byte UUID_HEADER = VariantUtil.primitiveHeader(Primitives.TYPE_UUID); + private static final int MAX_SHORT_STRING_LENGTH = 64; Review Comment: I think the max length should be 63 (see https://github.com/apache/parquet-format/blob/master/VariantEncoding.md) instead of 64 and string length can be 0 to 63. ########## api/src/test/java/org/apache/iceberg/variants/VariantTestUtil.java: ########## @@ -107,6 +121,18 @@ static SerializedPrimitive createString(String string) { return SerializedPrimitive.from(buffer, buffer.get(0)); } + /** Creates a short string primitive of max 63 bytes to use only 1 header */ + static SerializedShortString createShortString(String string) { + Preconditions.checkArgument( + string.length() <= 63, Review Comment: We can use the defined MAX_SHORT_STRING_LENGTH constant here. ########## api/src/test/java/org/apache/iceberg/variants/VariantTestUtil.java: ########## @@ -78,6 +78,20 @@ public static void assertEqual(VariantValue expected, VariantValue actual) { } } + public static void assertVariantString(VariantValue actual, String expected) { + int maxShortStringLength = 64; Review Comment: Similarly, I think we should say max length is 63 to be consistent with the spec. -- 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-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org