rdblue commented on code in PR #12457: URL: https://github.com/apache/iceberg/pull/12457#discussion_r1999841799
########## core/src/main/java/org/apache/iceberg/avro/ValueWriters.java: ########## @@ -373,6 +382,82 @@ public void write(BigDecimal decimal, Encoder encoder) throws IOException { } } + private abstract static class VariantBinaryWriter<T> implements ValueWriter<T> { + private ByteBuffer reusedBuffer = ByteBuffer.allocate(2048).order(ByteOrder.LITTLE_ENDIAN); + + protected abstract int sizeInBytes(T value); + + protected abstract int writeTo(ByteBuffer buffer, int offset, T value); + + @Override + public void write(T datum, Encoder encoder) throws IOException { + if (datum instanceof Serialized) { + encoder.writeBytes(((Serialized) datum).buffer()); Review Comment: Yeah, that's correct. It seems reasonable to me to avoid the copy. -- 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