xiaokang commented on code in PR #26126:
URL: https://github.com/apache/doris/pull/26126#discussion_r1379551076


##########
fe/fe-common/src/main/java/org/apache/doris/catalog/Type.java:
##########
@@ -2169,6 +2169,17 @@ public static boolean matchExactType(Type type1, Type 
type2, boolean ignorePreci
                     return false;
                 }
                 return matchExactType(((ArrayType) type2).getItemType(), 
((ArrayType) type1).getItemType());
+            } else if (type2.isMapType()) {
+                // For types array, we also need to check contains null for 
case like

Review Comment:
   map



##########
fe/fe-common/src/main/java/org/apache/doris/catalog/MapType.java:
##########
@@ -192,8 +192,10 @@ protected String prettyPrint(int lpad) {
     }
 
     public static boolean canCastTo(MapType type, MapType targetType) {
-        return Type.canCastTo(type.getKeyType(), targetType.getKeyType())
-            && Type.canCastTo(type.getValueType(), targetType.getValueType());
+        return (targetType.getKeyType().isStringType() && 
type.getKeyType().isStringType()

Review Comment:
   1. add parenthesis for more clear AND OR logic
   2. Is already true for StringType canCastTo any type?



##########
fe/fe-common/src/main/java/org/apache/doris/catalog/Type.java:
##########
@@ -2169,6 +2169,17 @@ public static boolean matchExactType(Type type1, Type 
type2, boolean ignorePreci
                     return false;
                 }
                 return matchExactType(((ArrayType) type2).getItemType(), 
((ArrayType) type1).getItemType());
+            } else if (type2.isMapType()) {

Review Comment:
   Why we need special branch for decimal,array,map? Can we encapsulate all 
logic in each type's matchesType() or a new method?



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to