raminqaf commented on code in PR #29101:
URL: https://github.com/apache/flink/pull/29101#discussion_r3933499611
##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/logical/utils/LogicalTypeCasts.java:
##########
@@ -679,6 +689,13 @@ private static boolean supportsCasting(
// BITMAP can only be cast to BYTES (unbounded VARBINARY), because
trimming or padding
// would corrupt the serialized bitmap data.
return allowExplicit && getLength(targetType) ==
VarBinaryType.MAX_LENGTH;
+ } else if (sourceRoot == UUID && targetRoot == BINARY) {
+ // A UUID is exactly 16 bytes, so it maps to BINARY(16). Any other
width would pad or
+ // trim the value and thereby corrupt it.
+ return allowExplicit && getLength(targetType) == 16;
+ } else if (sourceRoot == UUID && targetRoot == VARBINARY) {
+ // A UUID can only be cast to BYTES (unbounded VARBINARY), for the
same reason.
+ return allowExplicit && getLength(targetType) ==
VarBinaryType.MAX_LENGTH;
Review Comment:
That is true... Changed it to:
```java
getLength(targetType) >= 16
```
Now the targetType needs to be just bigger than 16 bytes so the UUID fits in
--
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]