slinkydeveloper commented on a change in pull request #18611:
URL: https://github.com/apache/flink/pull/18611#discussion_r807755945



##########
File path: 
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/casting/CastRuleProvider.java
##########
@@ -107,6 +108,16 @@ public static boolean exists(LogicalType inputType, 
LogicalType targetType) {
         return resolve(inputType, targetType) != null;
     }
 
+    /**
+     * Resolves the rule and returns the result of {@link 
CastRule#canFail(LogicalType,
+     * LogicalType)}. Fails with {@link NullPointerException} if the rule 
cannot be resolved.
+     */
+    public static boolean canFail(LogicalType inputType, LogicalType 
targetType) {
+        return Preconditions.checkNotNull(
+                        resolve(inputType, targetType), "Cast rule cannot be 
resolved")
+                .canFail(inputType, targetType);

Review comment:
       I pushed in the last commit a consistent change to fix this, in order to 
merge the "can fail" algorithm with the rule matching algorithm.




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