@@ -94,6 +94,7 @@ public class CreateFunctionStmt extends DdlStmt {
9494 public static final String IS_RETURN_NULL = "always_nullable" ;
9595 private static final Logger LOG = LogManager .getLogger (CreateFunctionStmt .class );
9696
97+ private SetType type = SetType .DEFAULT ;
9798 private final boolean ifNotExists ;
9899 private final FunctionName functionName ;
99100 private final boolean isAggregate ;
@@ -118,9 +119,10 @@ public class CreateFunctionStmt extends DdlStmt {
118119 // timeout for both connection and read. 10 seconds is long enough.
119120 private static final int HTTP_TIMEOUT_MS = 10000 ;
120121
121- public CreateFunctionStmt (boolean ifNotExists , boolean isAggregate , FunctionName functionName ,
122- FunctionArgsDef argsDef ,
123- TypeDef returnType , TypeDef intermediateType , Map <String , String > properties ) {
122+ public CreateFunctionStmt (SetType type , boolean ifNotExists , boolean isAggregate , FunctionName functionName ,
123+ FunctionArgsDef argsDef ,
124+ TypeDef returnType , TypeDef intermediateType , Map <String , String > properties ) {
125+ this .type = type ;
124126 this .ifNotExists = ifNotExists ;
125127 this .functionName = functionName ;
126128 this .isAggregate = isAggregate ;
@@ -137,8 +139,9 @@ public CreateFunctionStmt(boolean ifNotExists, boolean isAggregate, FunctionName
137139 this .originFunction = null ;
138140 }
139141
140- public CreateFunctionStmt (boolean ifNotExists , FunctionName functionName , FunctionArgsDef argsDef ,
142+ public CreateFunctionStmt (SetType type , boolean ifNotExists , FunctionName functionName , FunctionArgsDef argsDef ,
141143 List <String > parameters , Expr originFunction ) {
144+ this .type = type ;
142145 this .ifNotExists = ifNotExists ;
143146 this .functionName = functionName ;
144147 this .isAlias = true ;
@@ -154,6 +157,10 @@ public CreateFunctionStmt(boolean ifNotExists, FunctionName functionName, Functi
154157 this .properties = ImmutableSortedMap .of ();
155158 }
156159
160+ public SetType getType () {
161+ return type ;
162+ }
163+
157164 public boolean isIfNotExists () {
158165 return ifNotExists ;
159166 }
@@ -187,7 +194,7 @@ public void analyze(Analyzer analyzer) throws UserException {
187194
188195 private void analyzeCommon (Analyzer analyzer ) throws AnalysisException {
189196 // check function name
190- functionName .analyze (analyzer );
197+ functionName .analyze (analyzer , this . type );
191198
192199 // check operation privilege
193200 if (!Env .getCurrentEnv ().getAccessManager ().checkGlobalPriv (ConnectContext .get (), PrivPredicate .ADMIN )) {
0 commit comments