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


##########
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:
   Correct. This is explained a bit later in the section (the next page in the 
print version), where it says:
   > In the absence of explicit application or presentation protocol 
specification to the contrary, [...] the fields are encoded as 16 octets, with 
the sizes and order of the fields defined above, and with each field encoded 
with the Most Significant Byte first (known as network byte order).
   
   In other words: unless we explicitly want to document otherwise, everything 
is in network order (also known as big-endian).



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