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

morrysnow 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 04390fb1317 [fix](Nereids) array_intersect should be a variadic 
function (#34543)
04390fb1317 is described below

commit 04390fb13171fbf8189bdc823ea8f7c376dfb906
Author: morrySnow <101034200+morrys...@users.noreply.github.com>
AuthorDate: Thu May 9 10:22:30 2024 +0800

    [fix](Nereids) array_intersect should be a variadic function (#34543)
---
 .../expressions/functions/scalar/ArrayIntersect.java   | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ArrayIntersect.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ArrayIntersect.java
index 0811304e51f..fdda79a35b0 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ArrayIntersect.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/ArrayIntersect.java
@@ -21,10 +21,10 @@ import org.apache.doris.catalog.FunctionSignature;
 import org.apache.doris.nereids.trees.expressions.Expression;
 import 
org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
 import org.apache.doris.nereids.trees.expressions.functions.PropagateNullable;
-import org.apache.doris.nereids.trees.expressions.shape.BinaryExpression;
 import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
 import org.apache.doris.nereids.types.ArrayType;
 import org.apache.doris.nereids.types.coercion.AnyDataType;
+import org.apache.doris.nereids.util.ExpressionUtils;
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
@@ -34,19 +34,18 @@ import java.util.List;
 /**
  * ScalarFunction 'array_intersect'. This class is generated by 
GenerateFunction.
  */
-public class ArrayIntersect extends ScalarFunction implements 
ExplicitlyCastableSignature,
-        BinaryExpression, PropagateNullable {
+public class ArrayIntersect extends ScalarFunction implements 
ExplicitlyCastableSignature, PropagateNullable {
 
     public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
             FunctionSignature.retArgType(0)
-                    .args(ArrayType.of(new AnyDataType(0)), ArrayType.of(new 
AnyDataType(0)))
+                    .varArgs(ArrayType.of(new AnyDataType(0)), 
ArrayType.of(new AnyDataType(0)))
     );
 
     /**
-     * constructor with 2 arguments.
+     * constructor with 2 or more arguments.
      */
-    public ArrayIntersect(Expression arg0, Expression arg1) {
-        super("array_intersect", arg0, arg1);
+    public ArrayIntersect(Expression arg0, Expression arg1, Expression... 
varArgs) {
+        super("array_intersect", ExpressionUtils.mergeArguments(arg0, arg1, 
varArgs));
     }
 
     /**
@@ -54,8 +53,9 @@ public class ArrayIntersect extends ScalarFunction implements 
ExplicitlyCastable
      */
     @Override
     public ArrayIntersect withChildren(List<Expression> children) {
-        Preconditions.checkArgument(children.size() == 2);
-        return new ArrayIntersect(children.get(0), children.get(1));
+        Preconditions.checkArgument(children.size() >= 2);
+        return new ArrayIntersect(children.get(0), children.get(1),
+                children.subList(2, children.size()).toArray(new 
Expression[0]));
     }
 
     @Override


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

Reply via email to