@@ -95,6 +95,7 @@ public class CreateFunctionStmt extends DdlStmt {
9595 public static final String IS_RETURN_NULL = "always_nullable" ;
9696 private static final Logger LOG = LogManager .getLogger (CreateFunctionStmt .class );
9797
98+ private SetType type = SetType .DEFAULT ;
9899 private final boolean ifNotExists ;
99100 private final FunctionName functionName ;
100101 private final boolean isAggregate ;
@@ -119,9 +120,10 @@ public class CreateFunctionStmt extends DdlStmt {
119120 // timeout for both connection and read. 10 seconds is long enough.
120121 private static final int HTTP_TIMEOUT_MS = 10000 ;
121122
122- public CreateFunctionStmt (boolean ifNotExists , boolean isAggregate , FunctionName functionName ,
123- FunctionArgsDef argsDef ,
124- TypeDef returnType , TypeDef intermediateType , Map <String , String > properties ) {
123+ public CreateFunctionStmt (SetType type , boolean ifNotExists , boolean isAggregate , FunctionName functionName ,
124+ FunctionArgsDef argsDef ,
125+ TypeDef returnType , TypeDef intermediateType , Map <String , String > properties ) {
126+ this .type = type ;
125127 this .ifNotExists = ifNotExists ;
126128 this .functionName = functionName ;
127129 this .isAggregate = isAggregate ;
@@ -138,8 +140,9 @@ public CreateFunctionStmt(boolean ifNotExists, boolean isAggregate, FunctionName
138140 this .originFunction = null ;
139141 }
140142
141- public CreateFunctionStmt (boolean ifNotExists , FunctionName functionName , FunctionArgsDef argsDef ,
143+ public CreateFunctionStmt (SetType type , boolean ifNotExists , FunctionName functionName , FunctionArgsDef argsDef ,
142144 List <String > parameters , Expr originFunction ) {
145+ this .type = type ;
143146 this .ifNotExists = ifNotExists ;
144147 this .functionName = functionName ;
145148 this .isAlias = true ;
@@ -155,6 +158,10 @@ public CreateFunctionStmt(boolean ifNotExists, FunctionName functionName, Functi
155158 this .properties = ImmutableSortedMap .of ();
156159 }
157160
161+ public SetType getType () {
162+ return type ;
163+ }
164+
158165 public boolean isIfNotExists () {
159166 return ifNotExists ;
160167 }
@@ -188,7 +195,7 @@ public void analyze(Analyzer analyzer) throws UserException {
188195
189196 private void analyzeCommon (Analyzer analyzer ) throws AnalysisException {
190197 // check function name
191- functionName .analyze (analyzer );
198+ functionName .analyze (analyzer , this . type );
192199
193200 // check operation privilege
194201 if (!Env .getCurrentEnv ().getAccessManager ().checkGlobalPriv (ConnectContext .get (), PrivPredicate .ADMIN )) {
0 commit comments