davidradl commented on code in PR #29163:
URL: https://github.com/apache/flink/pull/29163#discussion_r3990552031


##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/VariantCastUtils.java:
##########
@@ -271,6 +274,21 @@ public static int toTime(Variant variant, int precision) {
         throw unsupportedKind(variant, String.format("TIME(%d)", precision));
     }
 
+    /**
+     * Reads a UUID variant as the target {@code UUID}, encoded as the 
canonical 16-byte big-endian
+     * representation.
+     */
+    public static byte[] toUuid(Variant variant) {
+        if (variant.getType() == Variant.Type.UUID) {
+            final UUID uuid = variant.getUuid();
+            final ByteBuffer buffer = 
ByteBuffer.allocate(UuidType.BYTE_LENGTH);
+            buffer.putLong(uuid.getMostSignificantBits());

Review Comment:
   nit: maybe worth adding buffer.order(ByteOrder.BIG_ENDIAN); so it is 
explicit.



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