Fokko commented on code in PR #2652:
URL: https://github.com/apache/avro/pull/2652#discussion_r1464763230


##########
lang/java/avro/src/main/java/org/apache/avro/Conversions.java:
##########
@@ -68,6 +69,22 @@ public UUID fromCharSequence(CharSequence value, Schema 
schema, LogicalType type
     public CharSequence toCharSequence(UUID value, Schema schema, LogicalType 
type) {
       return value.toString();
     }
+
+    @Override
+    public UUID fromFixed(final GenericFixed value, final Schema schema, final 
LogicalType type) {
+      ByteBuffer buffer = ByteBuffer.wrap(value.bytes());
+      long mostSigBits = buffer.getLong();
+      long leastSigBits = buffer.getLong();
+      return new UUID(mostSigBits, leastSigBits);
+    }
+
+    @Override
+    public GenericFixed toFixed(final UUID value, final Schema schema, final 
LogicalType type) {
+      ByteBuffer buffer = ByteBuffer.allocate(2 * Long.BYTES);

Review Comment:
   Do we want to re-use the buffer? This avoids reallocating the buffer each 
time.
   
   
https://github.com/apache/iceberg/blob/main/core/src/main/java/org/apache/iceberg/avro/ValueReaders.java#L396-L402



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

Reply via email to