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



##########
File path: 
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/functions/CastFunctionITCase.java
##########
@@ -1142,14 +1146,27 @@ protected Configuration configuration() {
 
     public static List<TestSpec> constructedTypes() {
         return Arrays.asList(
-                // https://issues.apache.org/jira/browse/FLINK-17321
-                // MULTISET
-                // MAP
+                CastTestSpecBuilder.testCastTo(MAP(STRING(), STRING()))
+                        .fromCase(MAP(FLOAT(), DOUBLE()), null, null)
+                        .fromCase(
+                                MAP(INT(), INT()),
+                                Collections.singletonMap(1, 2),
+                                Collections.singletonMap("1", "2"))

Review comment:
       It should not fail, the goal of this issue is to allow such casting. The 
thing is that I'm actually surprised it doesn't fail without touching 
`LogicalTypeCasts`, which is the class that checks valid/invalid casts.
   
   EDIT: I've done some debugging, 
`LogicalTypeCasts#supportsConstructedCasting` does the job and just checks for 
the equality of the type root and for the castability of the children. So it 
works :smile: 




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