opwvhk commented on code in PR #2652:
URL: https://github.com/apache/avro/pull/2652#discussion_r1464975969
##########
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:
Also, a
[`ByteBuffer`](https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html)
(as per its Javadoc) is initially always 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]