morningman commented on code in PR #17608:
URL: https://github.com/apache/doris/pull/17608#discussion_r1133259584
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java:
##########
@@ -1924,6 +1927,18 @@ public long loadMTMVJobManager(DataInputStream in, long
checksum) throws IOExcep
return checksum;
}
+ /**
+ * Load global function.
+ **/
+ public long loadGlobalFunction(DataInputStream in, long checksum) throws
IOException {
+ GlobalFunctionMgr mgr = GlobalFunctionMgr.read(in);
+ if (mgr != null) {
Review Comment:
Under what circumstances, mgr is null?
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/ShowFunctionsStmt.java:
##########
@@ -51,7 +51,21 @@ public class ShowFunctionsStmt extends ShowStmt {
private Expr expr;
- public ShowFunctionsStmt(String dbName, boolean isBuiltin, boolean
isVerbose, String wild, Expr expr) {
+ private SetType type = SetType.DEFAULT;
+
+ public ShowFunctionsStmt(String dbName, boolean isBuiltin, boolean
isVerbose, String wild,
+ Expr expr) {
+ this.type = type;
Review Comment:
missing `type` param?
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java:
##########
@@ -2161,6 +2176,12 @@ public long saveMTMVJobManager(CountingDataOutputStream
out, long checksum) thro
return checksum;
}
+ public long saveGlobalFunction(CountingDataOutputStream out, long
checksum) throws IOException {
+ Env.getCurrentEnv().getGlobalFunctionMgr().write(out);
Review Comment:
```suggestion
this.globalFunctionMgr.write(out);
```
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/GlobalFunctionMgr.java:
##########
@@ -0,0 +1,99 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.catalog;
+
+import org.apache.doris.common.AnalysisException;
+import org.apache.doris.common.UserException;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Maps;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.ConcurrentMap;
+
+public class GlobalFunctionMgr extends MetaObject {
Review Comment:
Add some comments to this class
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java:
##########
@@ -4811,8 +4832,13 @@ public void replayTruncateTable(TruncateTableInfo info)
throws MetaNotFoundExcep
public void createFunction(CreateFunctionStmt stmt) throws UserException {
FunctionName name = stmt.getFunctionName();
- Database db = getInternalCatalog().getDbOrDdlException(name.getDb());
- db.addFunction(stmt.getFunction(), stmt.isIfNotExists());
+ InternalCatalog internalCatalog = getInternalCatalog();
Review Comment:
Move this line to `else` block
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]