This is an automated email from the ASF dual-hosted git repository.

zclll pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 7eeb09fe8d6 [Chore](FE) Add comment to AnyDataType and rename improper 
function name (#55735)
7eeb09fe8d6 is described below

commit 7eeb09fe8d6668cd6a7501ff471bec120103ecd7
Author: zclllyybb <[email protected]>
AuthorDate: Tue Sep 9 11:58:57 2025 +0800

    [Chore](FE) Add comment to AnyDataType and rename improper function name 
(#55735)
---
 .../expressions/functions/ComputeSignature.java    |  2 +-
 .../functions/ComputeSignatureHelper.java          | 22 ++++------------------
 .../doris/nereids/types/coercion/AnyDataType.java  |  6 ++++++
 .../types/coercion/FollowToAnyDataType.java        |  5 +++++
 4 files changed, 16 insertions(+), 19 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ComputeSignature.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ComputeSignature.java
index ba902847e92..e3c80a903f4 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ComputeSignature.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ComputeSignature.java
@@ -113,7 +113,7 @@ public interface ComputeSignature extends FunctionTrait, 
ImplicitCastInputTypes
                 .then(ComputeSignatureHelper::computePrecision)
                 
.then(ComputeSignatureHelper::implementFollowToArgumentReturnType)
                 .then(ComputeSignatureHelper::normalizeDecimalV2)
-                .then(ComputeSignatureHelper::dynamicComputePropertiesOfArray)
+                .then(ComputeSignatureHelper::ensureNestedNullableOfArray)
                 .then(ComputeSignatureHelper::dynamicComputeVariantArgs)
                 .get();
     }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ComputeSignatureHelper.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ComputeSignatureHelper.java
index 365ae289237..8d23b44cd5b 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ComputeSignatureHelper.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ComputeSignatureHelper.java
@@ -358,28 +358,14 @@ public class ComputeSignatureHelper {
         return signature;
     }
 
-    /** dynamicComputePropertiesOfArray */
-    public static FunctionSignature dynamicComputePropertiesOfArray(
-            FunctionSignature signature, List<Expression> arguments) {
+    /** ensureNestedNullableOfArray */
+    public static FunctionSignature 
ensureNestedNullableOfArray(FunctionSignature signature,
+            List<Expression> arguments) {
         if (!(signature.returnType instanceof ArrayType)) {
             return signature;
         }
-
-        // fill item type by the type of first item
         ArrayType arrayType = (ArrayType) signature.returnType;
-
-        // Now Array type do not support ARRAY<NOT_NULL>, set it to true 
temporarily
-        boolean containsNull = true;
-
-        // fill containsNull if any array argument contains null
-        /* boolean containsNull = arguments
-                .stream()
-                .map(Expression::getDataType)
-                .filter(argType -> argType instanceof ArrayType)
-                .map(ArrayType.class::cast)
-                .anyMatch(ArrayType::containsNull);*/
-        return signature.withReturnType(
-                ArrayType.of(arrayType.getItemType(), arrayType.containsNull() 
|| containsNull));
+        return signature.withReturnType(ArrayType.of(arrayType.getItemType(), 
true));
     }
 
     // for time type with precision(now are DateTimeV2Type and TimeV2Type),
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/coercion/AnyDataType.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/coercion/AnyDataType.java
index 10cbc625d19..0e41c136c83 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/coercion/AnyDataType.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/coercion/AnyDataType.java
@@ -25,6 +25,12 @@ import java.util.Locale;
 
 /**
  * Represent any datatype in type coercion.
+ * with index = -1: individual slot, just accept any input type. process in 
`implementAnyDataTypeWithOutIndex`
+ * with index != -1: slots with same index are treated as type-equal. target 
type is the common type of them.
+ * for example:
+ *  two slots with AnyDataType(0) has type int and bigint separately, then the 
target type of both is bigint.
+ *  process in `implementAnyDataTypeWithIndex`.
+ * AnyDataType could NOT be return type. see more in FollowToAnyDataType.java
  */
 public class AnyDataType extends DataType {
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/coercion/FollowToAnyDataType.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/coercion/FollowToAnyDataType.java
index d6a70078084..32b4d6999f3 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/coercion/FollowToAnyDataType.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/coercion/FollowToAnyDataType.java
@@ -24,6 +24,11 @@ import java.util.Locale;
 
 /**
  * FollowToAnyDataType is used to auto compute the return type by the 
AnyDataType in signature.
+ * FollowToAnyDataType(x) will coerce to the concrete type which the argument 
with AnyDataType(x) coerced to.
+ * for example:
+ *  function signature is (AnyDataType(0), AnyDataType(0)) -> 
FollowToAnyDataType(0). and the arguments are
+ *  (int, bigint). then the return type is bigint.
+ * FollowToAnyDataType could be argument or return type. see more in 
AnyDataType.java
  */
 public class FollowToAnyDataType extends DataType {
 


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

Reply via email to