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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to