dawidwys commented on a change in pull request #14067:
URL: https://github.com/apache/flink/pull/14067#discussion_r524296997



##########
File path: 
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/logical/utils/LogicalTypeCasts.java
##########
@@ -298,27 +298,27 @@ private static boolean supportsCasting(
                final LogicalTypeRoot sourceRoot = sourceType.getTypeRoot();
                final LogicalTypeRoot targetRoot = targetType.getTypeRoot();
 
-               if (hasFamily(sourceType, INTERVAL) && hasFamily(targetType, 
EXACT_NUMERIC)) {
+               if (sourceRoot == NULL) {
+                       // null can be cast to an arbitrary type
+                       return true;
+               } else if (hasFamily(sourceType, INTERVAL) && 
hasFamily(targetType, EXACT_NUMERIC)) {
                        // cast between interval and exact numeric is only 
supported if interval has a single field
                        return isSingleFieldInterval(sourceType);
                } else if (hasFamily(sourceType, EXACT_NUMERIC) && 
hasFamily(targetType, INTERVAL)) {
                        // cast between interval and exact numeric is only 
supported if interval has a single field
                        return isSingleFieldInterval(targetType);
-               } else if (hasFamily(sourceType, CONSTRUCTED) || 
hasFamily(targetType, CONSTRUCTED)) {
-                       return supportsConstructedCasting(sourceType, 
targetType, allowExplicit);
                } else if (sourceRoot == DISTINCT_TYPE && targetRoot == 
DISTINCT_TYPE) {
                        // the two distinct types are not equal (from initial 
invariant), casting is not possible
                        return false;
                } else if (sourceRoot == DISTINCT_TYPE) {

Review comment:
       nit: Shouldn't we move the `DISTINCT_TYPE` just after the `NULL`?




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to