RussellSpitzer commented on code in PR #13284: URL: https://github.com/apache/iceberg/pull/13284#discussion_r2138577643
########## core/src/main/java/org/apache/iceberg/variants/PrimitiveWrapper.java: ########## @@ -208,15 +213,22 @@ public int writeTo(ByteBuffer outBuffer, int offset) { VariantUtil.writeBufferAbsolute(outBuffer, offset + 5, binary); return 5 + binary.remaining(); case STRING: - // TODO: use short string when possible + byte[] valueBytes = ((String) value).getBytes(StandardCharsets.UTF_8); if (null == buffer) { - this.buffer = ByteBuffer.wrap(((String) value).getBytes(StandardCharsets.UTF_8)); + this.buffer = ByteBuffer.wrap(valueBytes); + } + if (valueBytes.length < SHORT_STRING_LENGTH) { + outBuffer.put( + offset, + (byte) (VariantUtil.primitiveHeader(valueBytes.length) | SHORT_STRING_LENGTH_UMASK)); Review Comment: I'm also not sure this is right ... Shouldn't we be doing a l (length << 2 | UMASK) -- 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