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


##########
fe/fe-common/src/main/java/org/apache/doris/catalog/MapType.java:
##########
@@ -121,6 +122,33 @@ public boolean matchesType(Type t) {
             && (valueType.matchesType(((MapType) t).valueType));
     }
 
+    @Override
+    public boolean hasTemplateType() {
+        return keyType.hasTemplateType() || valueType.hasTemplateType();
+    }
+
+    @Override
+    public Type specializeTemplateType(Type specificType, Map<String, Type> 
specializedTypeMap,
+                                       boolean useSpecializedType) throws 
TypeException {
+        if (!(specificType instanceof MapType)) {
+            throw new TypeException(specificType + " is not MapType");
+        }
+
+        MapType specificMapType = (MapType) specificType;
+        Type newKeyType = keyType;
+        if (keyType.hasTemplateType()) {
+            newKeyType = keyType.specializeTemplateType(
+                specificMapType.keyType, specializedTypeMap, 
useSpecializedType);
+        }
+        Type newValueType = valueType;
+        if (valueType.hasTemplateType()) {
+            newValueType = valueType.specializeTemplateType(
+                specificMapType.valueType, specializedTypeMap, 
useSpecializedType);
+        }
+
+        return new MapType(newKeyType, newValueType);

Review Comment:
   yes. MAP<K, INT> + MAP<STRING, BIGINT> => MAP<STRING, INT> is wrong if 
canCastTo not checked.



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