github-actions[bot] commented on code in PR #64080:
URL: https://github.com/apache/doris/pull/64080#discussion_r3411726764


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/types/MapType.java:
##########
@@ -63,6 +64,15 @@ public DataType conversion() {
         return MapType.of(keyType.conversion(), valueType.conversion());
     }
 
+    @Override
+    public boolean isInjectiveCastTo(DataType target) {
+        if (target instanceof MapType) {
+            MapType mapType = (MapType) target;
+            return keyType.isInjectiveCastTo(mapType.keyType) && 
valueType.isInjectiveCastTo(mapType.valueType);
+        }
+        return target instanceof CharacterType;

Review Comment:
   This `MapType -> MapType` predicate is a separate false positive from the 
existing complex-to-character thread. BE map-to-map casts convert the key/value 
columns and then call `ColumnMap::deduplicate_keys()`, while map equality/hash 
still include the raw entry count and key/value sequence before the cast. A map 
value with duplicate keys can therefore be distinct before the cast but 
normalize to the same value after it; for example, external/map-serde input 
with entries `[(1,10),(1,20)]` and another row `[(1,20)]` are different source 
maps, but `CAST(m AS MAP<BIGINT, INT>)` keeps only the last `1` entry in both 
rows. If this cast is pushed below `UNION DISTINCT`, duplicate elimination 
happens after that normalization and can collapse a row the original plan would 
keep. Please keep map-to-map casts unsafe unless the rule can prove the source 
map is already key-deduplicated, or account for the BE dedup behavior here.



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