diff --git a/fe/src/main/java/org/apache/doris/analysis/CreateFunctionStmt.java b/fe/src/main/java/org/apache/doris/analysis/CreateFunctionStmt.java index 079d0e01c1..392e51282a 100644 --- a/fe/src/main/java/org/apache/doris/analysis/CreateFunctionStmt.java +++ b/fe/src/main/java/org/apache/doris/analysis/CreateFunctionStmt.java @@ -150,8 +150,8 @@ public class CreateFunctionStmt extends DdlStmt { private void analyzeUda() throws AnalysisException { AggregateFunction.AggregateFunctionBuilder builder = AggregateFunction.AggregateFunctionBuilder.createUdfBuilder(); - builder.name(functionName).argsType(argsDef.getArgTypes()).retType(returnType.getType()) - .intermediateType(intermediateType.getType()).objectFile(objectFile); + builder.name(functionName).argsType(argsDef.getArgTypes()).retType(returnType.getType()). + hasVarArgs(argsDef.isVariadic()).intermediateType(intermediateType.getType()).objectFile(objectFile); String initFnSymbol = properties.get(INIT_KEY); if (initFnSymbol == null) { throw new AnalysisException("No 'init_fn' in properties"); diff --git a/fe/src/main/java/org/apache/doris/catalog/AggregateFunction.java b/fe/src/main/java/org/apache/doris/catalog/AggregateFunction.java index 18cf832225..e0ef1fc953 100644 --- a/fe/src/main/java/org/apache/doris/catalog/AggregateFunction.java +++ b/fe/src/main/java/org/apache/doris/catalog/AggregateFunction.java @@ -177,11 +177,11 @@ public class AggregateFunction extends Function { // Used to create UDAF public AggregateFunction(FunctionName fnName, Type[] argTypes, - Type retType, Type intermediateType, String location, + Type retType, boolean hasVarArgs, Type intermediateType, String location, String initFnSymbol, String updateFnSymbol, String mergeFnSymbol, String serializeFnSymbol, String finalizeFnSymbol, String getValueFnSymbol, String removeFnSymbol) { - super(fnName, argTypes, retType, false); + super(fnName, argTypes, retType, hasVarArgs); this.setLocation(new HdfsURI(location)); this.intermediateType = (intermediateType.equals(retType)) ? null : intermediateType; this.updateFnSymbol = updateFnSymbol; @@ -202,6 +202,7 @@ public class AggregateFunction extends Function { FunctionName name; Type[] argTypes; Type retType; + boolean hasVarArgs; Type intermediateType; String objectFile; String initFnSymbol; @@ -235,6 +236,11 @@ public class AggregateFunction extends Function { return this; } + public AggregateFunctionBuilder hasVarArgs(boolean hasVarArgs) { + this.hasVarArgs = hasVarArgs; + return this; + } + public AggregateFunctionBuilder intermediateType(Type type) { this.intermediateType = type; return this; @@ -281,8 +287,8 @@ public class AggregateFunction extends Function { } public AggregateFunction build() { - AggregateFunction fn = new AggregateFunction(name, argTypes, retType, intermediateType, objectFile, - initFnSymbol, updateFnSymbol, mergeFnSymbol, + AggregateFunction fn = new AggregateFunction(name, argTypes, retType, hasVarArgs, intermediateType, + objectFile, initFnSymbol, updateFnSymbol, mergeFnSymbol, serializeFnSymbol, finalizeFnSymbol, getValueFnSymbol, removeFnSymbol); fn.setBinaryType(binaryType);