slinkydeveloper commented on a change in pull request #18611:
URL: https://github.com/apache/flink/pull/18611#discussion_r807008892
##########
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:
Rather than making `CastRule`s mutable, which i don't really like as
solution, I think we could make `matches` a three valued logic function: a
result of a matches is either `SUPPORT`, `FALLIBLE`, `UNSUPPORTED`. WDYT?
##########
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:
Rather than making `CastRule`s mutable, which i don't really like as
solution, I think we could make `matches` a three valued logic function: a
result of a matches is either `SUPPORTED`, `FALLIBLE`, `UNSUPPORTED`. WDYT?
--
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]