matriv commented on a change in pull request #18162:
URL: https://github.com/apache/flink/pull/18162#discussion_r774482163



##########
File path: 
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/casting/BinaryToBinaryCastRule.java
##########
@@ -60,18 +62,35 @@ public String generateExpression(
         int inputLength = LogicalTypeChecks.getLength(inputLogicalType);
         int targetLength = LogicalTypeChecks.getLength(targetLogicalType);
 
-        if (context.legacyBehaviour()) {
+        if (context.legacyBehaviour()
+                || ((!couldTrim(targetLength)
+                                // Assume input length is respected by the 
source
+                                || (inputLength <= targetLength))

Review comment:
       I could revert it maybe to avoid the wrapping `not` but imho it's more 
readable to exit early or then apply the logic for trimming/padding.




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