twalthr commented on code in PR #27640:
URL: https://github.com/apache/flink/pull/27640#discussion_r2833266096


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/logical/utils/LogicalTypeCasts.java:
##########
@@ -151,6 +152,20 @@ public final class LogicalTypeCasts {
                     getPrecision(source) == getPrecision(target)
                             && getScale(source) == getScale(target);
 
+    /**
+     * Injective when the target binary length can hold worst-case UTF-8 
encoding (4 bytes/char).
+     */
+    private static final BiPredicate<LogicalType, LogicalType> 
WHEN_BINARY_LENGTH_FITS_UTF8 =
+            (source, target) -> {
+                if (hasMaxLength(source)) {
+                    return hasMaxLength(target);
+                }
+                if (hasMaxLength(target)) {

Review Comment:
   can't this condition be at the top as an early out?



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