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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/CreateMap.java:
##########
@@ -109,12 +115,95 @@ public List<FunctionSignature> getSignatures() {
         if (arity() == 0) {
             return SIGNATURES;
         } else {
-            return ImmutableList.of(FunctionSignature.of(
-                    getDataType(),
-                    children.stream()
-                            .map(ExpressionTrait::getDataType)
-                            .collect(ImmutableList.toImmutableList())
-            ));
+            // split children into keys and values
+            List<Expression> keyExpressions = new ArrayList<>();
+            List<Expression> valueExpressions = new ArrayList<>();
+            for (int i = 0; i < children.size(); i++) {
+                if (i % 2 == 0) {
+                    keyExpressions.add(children.get(i));
+                } else {
+                    valueExpressions.add(children.get(i));
+                }
+            }
+
+            // find common key type
+            Map<Boolean, List<Expression>> keyPartitioned = 
keyExpressions.stream()
+                    .collect(Collectors.partitioningBy(
+                            e -> (e instanceof Literal && ((Literal) 
e).isStringLikeLiteral())));
+            List<DataType> keyForFindCommon = 
keyPartitioned.get(false).stream()
+                    
.map(ExpressionTrait::getDataType).collect(Collectors.toList());
+            Optional<DataType> commonKeyType = 
TypeCoercionUtils.findWiderCommonTypeByVariable(

Review Comment:
   This PR mixes a `CreateMap` coercion rewrite into a datetime/nullif fix, but 
there is still no coverage for `map(...)` here. More importantly, this new 
direct-signature path no longer follows the old `processCreateMap()` 
implementation, which delegated key/value type resolution to `Array` and then 
cast every child against the resolved array item type. That older path had the 
same fallback behavior as the rest of Nereids type search. Here we now infer a 
single `commonKeyType/commonValueType` inside `CreateMap` and skip those 
established fallback rules, so the behavior of `map(...)` changes even though 
the PR title and tests are only about `DateTimeV2Type` and conditional 
simplification. Please either split this out or add dedicated FE UT/regression 
coverage for `map` mixed literal/decimal/datetime cases before merging.



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