snuyanzin commented on code in PR #29103:
URL: https://github.com/apache/flink/pull/29103#discussion_r3941316162


##########
flink-core/src/main/java/org/apache/flink/types/variant/BinaryVariantUtil.java:
##########
@@ -674,6 +703,20 @@ public static String getString(byte[] value, int pos) {
         throw unexpectedType(Type.STRING);
     }
 
+    public static UUID getUUID(byte[] value, int pos) {
+        checkIndex(pos, value.length);
+        int basicType = value[pos] & BASIC_TYPE_MASK;
+        int typeInfo = (value[pos] >> BASIC_TYPE_BITS) & TYPE_INFO_MASK;
+        if (basicType != PRIMITIVE || typeInfo != UUID) {
+            throw unexpectedType(Type.UUID);
+        }
+        // The 16 UUID bytes are big-endian (most significant bytes first): 
the most significant 8
+        // bytes followed by the least significant 8 bytes.
+        long msb = readLongBigEndian(value, pos + 1);
+        long lsb = readLongBigEndian(value, pos + 9);

Review Comment:
   do we need to have check for length/position 3 times within this method?
   Can we do it only once?



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