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

starocean999 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 200336cd788 [Enhancement](nereids)support show create function (#51395)
200336cd788 is described below

commit 200336cd78845860f30891bfc32aaa250a288805
Author: lsy3993 <[email protected]>
AuthorDate: Wed Jun 4 15:30:26 2025 +0800

    [Enhancement](nereids)support show create function (#51395)
---
 .../antlr4/org/apache/doris/nereids/DorisParser.g4 |   6 +-
 .../doris/nereids/parser/LogicalPlanBuilder.java   |  27 +++
 .../apache/doris/nereids/trees/plans/PlanType.java |   1 +
 .../plans/commands/ShowCreateFunctionCommand.java  | 193 +++++++++++++++++++++
 .../trees/plans/visitor/CommandVisitor.java        |   5 +
 .../commands/ShowCreateFunctionCommandTest.java    |  93 ++++++++++
 .../show/test_show_create_function.groovy          |  46 +++++
 7 files changed, 368 insertions(+), 3 deletions(-)

diff --git a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 
b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
index ea59fda6c99..aeebfab49e4 100644
--- a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
+++ b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
@@ -325,6 +325,9 @@ supportedShowStatement
     | SHOW LAST INSERT                                                         
     #showLastInsert
     | SHOW ((CHAR SET) | CHARSET)                                              
     #showCharset
     | SHOW DELETE ((FROM | IN) database=multipartIdentifier)?                  
     #showDelete
+    | SHOW CREATE statementScope? FUNCTION functionIdentifier
+        LEFT_PAREN functionArguments? RIGHT_PAREN
+        ((FROM | IN) database=multipartIdentifier)?                            
     #showCreateFunction
     | SHOW FULL? BUILTIN? FUNCTIONS
         ((FROM | IN) database=multipartIdentifier)? (LIKE STRING_LITERAL)?     
     #showFunctions
     | SHOW GLOBAL FULL? FUNCTIONS (LIKE STRING_LITERAL)?                       
     #showGlobalFunctions
@@ -470,9 +473,6 @@ lockTable
 
 unsupportedShowStatement
     : SHOW CREATE MATERIALIZED VIEW name=multipartIdentifier                   
     #showMaterializedView
-    | SHOW CREATE statementScope? FUNCTION functionIdentifier
-        LEFT_PAREN functionArguments? RIGHT_PAREN
-        ((FROM | IN) database=multipartIdentifier)?                            
     #showCreateFunction
     | SHOW LOAD WARNINGS ((((FROM | IN) database=multipartIdentifier)?
         wildWhere? limitClause?) | (ON url=STRING_LITERAL))                    
     #showLoadWarings
     | SHOW ALTER TABLE (ROLLUP | (MATERIALIZED VIEW) | COLUMN)
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
index 54ef733c109..f466132a029 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
@@ -337,6 +337,7 @@ import 
org.apache.doris.nereids.DorisParser.ShowConstraintContext;
 import org.apache.doris.nereids.DorisParser.ShowConvertLscContext;
 import org.apache.doris.nereids.DorisParser.ShowCreateCatalogContext;
 import org.apache.doris.nereids.DorisParser.ShowCreateDatabaseContext;
+import org.apache.doris.nereids.DorisParser.ShowCreateFunctionContext;
 import org.apache.doris.nereids.DorisParser.ShowCreateMTMVContext;
 import org.apache.doris.nereids.DorisParser.ShowCreateMaterializedViewContext;
 import org.apache.doris.nereids.DorisParser.ShowCreateProcedureContext;
@@ -702,6 +703,7 @@ import 
org.apache.doris.nereids.trees.plans.commands.ShowConvertLSCCommand;
 import org.apache.doris.nereids.trees.plans.commands.ShowCopyCommand;
 import org.apache.doris.nereids.trees.plans.commands.ShowCreateCatalogCommand;
 import org.apache.doris.nereids.trees.plans.commands.ShowCreateDatabaseCommand;
+import org.apache.doris.nereids.trees.plans.commands.ShowCreateFunctionCommand;
 import org.apache.doris.nereids.trees.plans.commands.ShowCreateMTMVCommand;
 import 
org.apache.doris.nereids.trees.plans.commands.ShowCreateMaterializedViewCommand;
 import 
org.apache.doris.nereids.trees.plans.commands.ShowCreateProcedureCommand;
@@ -5862,6 +5864,31 @@ public class LogicalPlanBuilder extends 
DorisParserBaseVisitor<Object> {
         return new ShowCreateDatabaseCommand(new DbName(catalogName, 
databaseName));
     }
 
+    @Override
+    public LogicalPlan visitShowCreateFunction(ShowCreateFunctionContext ctx) {
+        SetType statementScope = visitStatementScope(ctx.statementScope());
+        FunctionName function = 
visitFunctionIdentifier(ctx.functionIdentifier());
+        String dbName = null;
+        FunctionArgTypesInfo functionArgTypesInfo;
+        if (ctx.functionArguments() != null) {
+            functionArgTypesInfo = 
visitFunctionArguments(ctx.functionArguments());
+        } else {
+            functionArgTypesInfo = new FunctionArgTypesInfo(new ArrayList<>(), 
false);
+        }
+        if (ctx.database != null) {
+            List<String> nameParts = visitMultipartIdentifier(ctx.database);
+            if (nameParts.size() == 1) {
+                dbName = nameParts.get(0);
+            } else if (nameParts.size() == 2) {
+                dbName = nameParts.get(1);
+            } else {
+                throw new AnalysisException("nameParts in analyze database 
should be [ctl.]db");
+            }
+        }
+
+        return new ShowCreateFunctionCommand(dbName, statementScope, function, 
functionArgTypesInfo);
+    }
+
     @Override
     public LogicalPlan visitCleanAllProfile(CleanAllProfileContext ctx) {
         return new CleanAllProfileCommand();
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/PlanType.java 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/PlanType.java
index b317e9b4c45..1e14e99a274 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/PlanType.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/PlanType.java
@@ -254,6 +254,7 @@ public enum PlanType {
     SHOW_CONFIG_COMMAND,
     SHOW_CREATE_CATALOG_COMMAND,
     SHOW_CREATE_DATABASE_COMMAND,
+    SHOW_CREATE_FUNCTION_COMMAND,
     SHOW_CREATE_MATERIALIZED_VIEW_COMMAND,
     SHOW_CREATE_REPOSITORY_COMMAND,
     SHOW_CREATE_TABLE_COMMAND,
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowCreateFunctionCommand.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowCreateFunctionCommand.java
new file mode 100644
index 00000000000..f8f722e005a
--- /dev/null
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowCreateFunctionCommand.java
@@ -0,0 +1,193 @@
+// 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.nereids.trees.plans.commands;
+
+import org.apache.doris.analysis.FunctionName;
+import org.apache.doris.analysis.RedirectStatus;
+import org.apache.doris.analysis.SetType;
+import org.apache.doris.catalog.Column;
+import org.apache.doris.catalog.Database;
+import org.apache.doris.catalog.DatabaseIf;
+import org.apache.doris.catalog.Env;
+import org.apache.doris.catalog.Function;
+import org.apache.doris.catalog.FunctionSearchDesc;
+import org.apache.doris.catalog.FunctionUtil;
+import org.apache.doris.catalog.ScalarType;
+import org.apache.doris.common.AnalysisException;
+import org.apache.doris.common.ErrorCode;
+import org.apache.doris.common.ErrorReport;
+import org.apache.doris.common.util.Util;
+import org.apache.doris.datasource.InternalCatalog;
+import org.apache.doris.mysql.privilege.PrivPredicate;
+import org.apache.doris.nereids.trees.plans.PlanType;
+import org.apache.doris.nereids.trees.plans.commands.info.FunctionArgTypesInfo;
+import org.apache.doris.nereids.trees.plans.visitor.PlanVisitor;
+import org.apache.doris.qe.ConnectContext;
+import org.apache.doris.qe.ShowResultSet;
+import org.apache.doris.qe.ShowResultSetMetaData;
+import org.apache.doris.qe.StmtExecutor;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * show create function
+ */
+public class ShowCreateFunctionCommand extends ShowCommand {
+    private static final ShowResultSetMetaData META_DATA =
+            ShowResultSetMetaData.builder()
+                .addColumn(new Column("Function Signature", 
ScalarType.createVarchar(512)))
+                .addColumn(new Column("Create Function", 
ScalarType.createVarchar(2048)))
+                .build();
+    private String dbName;
+    private SetType scope;
+    private FunctionName functionName;
+    private FunctionArgTypesInfo argsDef;
+    private FunctionSearchDesc function;
+
+    public ShowCreateFunctionCommand(String dbName, SetType scope, 
FunctionName functionName,
+                                         FunctionArgTypesInfo argsDef) {
+        super(PlanType.SHOW_CREATE_FUNCTION_COMMAND);
+        this.dbName = dbName;
+        this.scope = scope;
+        this.functionName = functionName;
+        this.argsDef = argsDef;
+    }
+
+    private static String reAcquireDbName(ConnectContext ctx, String dbName) 
throws AnalysisException {
+        if (Strings.isNullOrEmpty(dbName)) {
+            dbName = ctx.getDatabase();
+            if (Strings.isNullOrEmpty(dbName)) {
+                ErrorReport.reportAnalysisException(ErrorCode.ERR_NO_DB_ERROR);
+            }
+        }
+        return dbName;
+    }
+
+    private boolean isValidCharacter(char c) {
+        return Character.isLetterOrDigit(c) || c == '_';
+    }
+
+    @VisibleForTesting
+    protected void analyze(ConnectContext ctx, SetType type) throws 
AnalysisException {
+        String fn = functionName.getFunction();
+        if (fn.length() == 0) {
+            throw new AnalysisException("Function name can not be empty.");
+        }
+        for (int i = 0; i < fn.length(); ++i) {
+            if (!isValidCharacter(fn.charAt(i))) {
+                throw new AnalysisException("Function names must be all 
alphanumeric or underscore. "
+                    + "Invalid name: " + fn);
+            }
+        }
+        if (Character.isDigit(fn.charAt(0))) {
+            throw new AnalysisException("Function cannot start with a digit: " 
+ fn);
+        }
+        if (dbName == null) {
+            dbName = ctx.getDatabase();
+            if (Strings.isNullOrEmpty(dbName) && type != SetType.GLOBAL) {
+                ErrorReport.reportAnalysisException(ErrorCode.ERR_NO_DB_ERROR);
+            }
+        }
+    }
+
+    private List<List<String>> getResultRowSetByFunction(Function function) {
+        if (Objects.isNull(function)) {
+            return Lists.newArrayList();
+        }
+        List<List<String>> resultRowSet = Lists.newArrayList();
+        List<String> resultRow = Lists.newArrayList();
+        resultRow.add(function.signatureString());
+        resultRow.add(function.toSql(false));
+        resultRowSet.add(resultRow);
+        return resultRowSet;
+    }
+
+    private List<List<String>> getResultRowSet(ConnectContext ctx) throws 
AnalysisException {
+        Function resultFunction = getFunction(ctx);
+        return getResultRowSetByFunction(resultFunction);
+    }
+
+    @VisibleForTesting
+    protected Function getFunction(ConnectContext ctx) throws 
AnalysisException {
+        if (!FunctionUtil.isGlobalFunction(scope)) {
+            Util.prohibitExternalCatalog(ctx.getDefaultCatalog(), 
this.getClass().getSimpleName());
+            DatabaseIf db = 
ctx.getCurrentCatalog().getDbOrAnalysisException(dbName);
+            if (db instanceof Database) {
+                return ((Database) db).getFunction(function);
+            }
+        } else {
+            return 
Env.getCurrentEnv().getGlobalFunctionMgr().getFunction(function);
+        }
+        return null;
+    }
+
+    @VisibleForTesting
+    protected ShowResultSet handleShowCreateFunction(ConnectContext ctx, 
StmtExecutor executor) throws Exception {
+        // the global function does not need to fetch/check the dbName
+        if (!FunctionUtil.isGlobalFunction(scope)) {
+            dbName = reAcquireDbName(ctx, dbName);
+        }
+
+        // analyze function name
+        analyze(ctx, scope);
+
+        // check operation privilege , except global function
+        if (!FunctionUtil.isGlobalFunction(scope) && 
!Env.getCurrentEnv().getAccessManager()
+                .checkDbPriv(ConnectContext.get(), 
InternalCatalog.INTERNAL_CATALOG_NAME, dbName, PrivPredicate.SHOW)) {
+            ErrorReport.reportAnalysisException(
+                    ErrorCode.ERR_DBACCESS_DENIED_ERROR, 
ConnectContext.get().getQualifiedUser(), dbName);
+        }
+
+        // check argument
+        argsDef.analyze();
+
+        if (!FunctionUtil.isGlobalFunction(scope)) {
+            functionName.setDb(dbName);
+        }
+        function = new FunctionSearchDesc(functionName, argsDef.getArgTypes(), 
argsDef.isVariadic());
+
+        // get result
+        List<List<String>> resultRowSet = getResultRowSet(ctx);
+        return new ShowResultSet(getMetaData(), resultRowSet);
+    }
+
+    @Override
+    public ShowResultSet doRun(ConnectContext ctx, StmtExecutor executor) 
throws Exception {
+        return handleShowCreateFunction(ctx, executor);
+    }
+
+    @Override
+    public <R, C> R accept(PlanVisitor<R, C> visitor, C context) {
+        return visitor.visitShowCreateFunctionCommand(this, context);
+    }
+
+    @Override
+    public RedirectStatus toRedirectStatus() {
+        return RedirectStatus.NO_FORWARD;
+    }
+
+    @Override
+    public ShowResultSetMetaData getMetaData() {
+        return META_DATA;
+    }
+}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/visitor/CommandVisitor.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/visitor/CommandVisitor.java
index 0004dc7f9a5..83ffa75e49d 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/visitor/CommandVisitor.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/visitor/CommandVisitor.java
@@ -157,6 +157,7 @@ import 
org.apache.doris.nereids.trees.plans.commands.ShowConvertLSCCommand;
 import org.apache.doris.nereids.trees.plans.commands.ShowCopyCommand;
 import org.apache.doris.nereids.trees.plans.commands.ShowCreateCatalogCommand;
 import org.apache.doris.nereids.trees.plans.commands.ShowCreateDatabaseCommand;
+import org.apache.doris.nereids.trees.plans.commands.ShowCreateFunctionCommand;
 import org.apache.doris.nereids.trees.plans.commands.ShowCreateMTMVCommand;
 import 
org.apache.doris.nereids.trees.plans.commands.ShowCreateMaterializedViewCommand;
 import 
org.apache.doris.nereids.trees.plans.commands.ShowCreateProcedureCommand;
@@ -721,6 +722,10 @@ public interface CommandVisitor<R, C> {
         return visitCommand(showCreateDatabaseCommand, context);
     }
 
+    default R visitShowCreateFunctionCommand(ShowCreateFunctionCommand 
showCreateFunctionCommand, C context) {
+        return visitCommand(showCreateFunctionCommand, context);
+    }
+
     default R visitShowCreateViewCommand(ShowCreateViewCommand 
showCreateViewCommand, C context) {
         return visitCommand(showCreateViewCommand, context);
     }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/ShowCreateFunctionCommandTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/ShowCreateFunctionCommandTest.java
new file mode 100644
index 00000000000..4506c8ad386
--- /dev/null
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/ShowCreateFunctionCommandTest.java
@@ -0,0 +1,93 @@
+// 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.nereids.trees.plans.commands;
+
+import org.apache.doris.analysis.FunctionName;
+import org.apache.doris.analysis.SetType;
+import org.apache.doris.catalog.Function;
+import org.apache.doris.common.AnalysisException;
+import org.apache.doris.nereids.trees.plans.commands.info.FunctionArgTypesInfo;
+import org.apache.doris.nereids.types.BigIntType;
+import org.apache.doris.nereids.types.DataType;
+import org.apache.doris.utframe.TestWithFeService;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ShowCreateFunctionCommandTest extends TestWithFeService {
+    @Override
+    protected void runBeforeAll() throws Exception {
+        connectContext.setDatabase(null);
+        createFunction(
+                "CREATE GLOBAL ALIAS FUNCTION 
test_for_create_global_function(bigint) "
+                    + "WITH PARAMETER(id) AS 
CONCAT(LEFT(id,3),'****',RIGHT(id,4));");
+        createDatabase("test");
+        connectContext.setDatabase("test");
+        createFunction(
+                "CREATE ALIAS FUNCTION test.test_for_create_function(bigint) "
+                    + "WITH PARAMETER(id) AS 
CONCAT(LEFT(id,3),'****',RIGHT(id,4));");
+    }
+
+    @Test
+    void testGetFunction() throws Exception {
+        // test for no database
+        FunctionName fn = new FunctionName("test_for_create_function");
+        ShowCreateFunctionCommand sc = new ShowCreateFunctionCommand("", 
SetType.DEFAULT, fn, null);
+        connectContext.setDatabase("");
+        ShowCreateFunctionCommand finalSc = sc;
+        Assertions.assertThrows(AnalysisException.class, () -> 
finalSc.getFunction(connectContext));
+
+        // test for test_for_create_function function
+        BigIntType bt = BigIntType.INSTANCE;
+        List<DataType> aList = new ArrayList<>();
+        aList.add(bt);
+        FunctionArgTypesInfo fati = new FunctionArgTypesInfo(aList, false);
+        sc = new ShowCreateFunctionCommand("test", SetType.DEFAULT, fn, fati);
+        sc.handleShowCreateFunction(connectContext, null);
+        Function fc = sc.getFunction(connectContext);
+        
Assertions.assertTrue(fc.getFunctionName().getFunction().equalsIgnoreCase("test_for_create_function"));
+
+        // test for global function
+        fn = new FunctionName("test_for_create_global_function");
+        sc = new ShowCreateFunctionCommand("", SetType.GLOBAL, fn, fati);
+        connectContext.setDatabase("");
+        sc.handleShowCreateFunction(connectContext, null);
+        fc = sc.getFunction(connectContext);
+        
Assertions.assertTrue(fc.getFunctionName().getFunction().equalsIgnoreCase("test_for_create_global_function"));
+    }
+
+    @Test
+    void testAnalyze() throws AnalysisException {
+        FunctionName fn = new FunctionName("test_for_create_function");
+        BigIntType bt = BigIntType.INSTANCE;
+        List<DataType> aList = new ArrayList<>();
+        aList.add(bt);
+        FunctionArgTypesInfo fatf = new FunctionArgTypesInfo(aList, false);
+        ShowCreateFunctionCommand sc = new ShowCreateFunctionCommand("test", 
SetType.DEFAULT, fn, fatf);
+        sc.analyze(connectContext, SetType.DEFAULT);
+
+        // wrong function name
+        fn = new FunctionName("test-for@create_function");
+        sc = new ShowCreateFunctionCommand("test", SetType.DEFAULT, fn, fatf);
+        ShowCreateFunctionCommand finalSc = sc;
+        Assertions.assertThrows(AnalysisException.class, () -> 
finalSc.analyze(connectContext, SetType.DEFAULT));
+    }
+}
diff --git 
a/regression-test/suites/nereids_p0/show/test_show_create_function.groovy 
b/regression-test/suites/nereids_p0/show/test_show_create_function.groovy
new file mode 100644
index 00000000000..19e97347a3d
--- /dev/null
+++ b/regression-test/suites/nereids_p0/show/test_show_create_function.groovy
@@ -0,0 +1,46 @@
+// 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.
+
+suite("test_nereids_show_create_function") {
+    sql "CREATE DATABASE IF NOT EXISTS show_create_function_db"
+    sql """CREATE ALIAS FUNCTION 
show_create_function_db.zzzyyyxxx_show_create_function_name(INT) WITH 
PARAMETER(id)  
+                AS CONCAT(LEFT(id, 3), '****', RIGHT(id, 4));"""
+    sql """CREATE GLOBAL ALIAS FUNCTION 
zzzyyyxxx_show_create_global_function_name(INT) 
+                WITH PARAMETER(id) AS CONCAT(LEFT(id, 3), '****', RIGHT(id, 
4));"""
+
+    checkNereidsExecute("use show_create_function_db; show create function 
zzzyyyxxx_show_create_function_name(INT);")
+    checkNereidsExecute("show create global function 
zzzyyyxxx_show_create_global_function_name(INT);")
+    checkNereidsExecute("show create function 
zzzyyyxxx_show_create_function_name(INT) from show_create_function_db")
+    checkNereidsExecute("show create function 
zzzyyyxxx_show_create_function_name(INT) in show_create_function_db")
+
+    def res = sql """use show_create_function_db; 
+                                          show create function 
zzzyyyxxx_show_create_function_name(INT);"""
+    assertTrue(res.size() == 1)
+    assertEquals("zzzyyyxxx_show_create_function_name(int)", res.get(0).get(0))
+
+    def res1 = sql """show create function 
zzzyyyxxx_show_create_function_name(INT) from show_create_function_db;"""
+    assertTrue(res1.size() == 1)
+    assertEquals("zzzyyyxxx_show_create_function_name(int)", 
res1.get(0).get(0))
+
+    def res2 = sql """show create function 
zzzyyyxxx_show_create_function_name(INT) in show_create_function_db;"""
+    assertTrue(res2.size() == 1)
+    assertEquals("zzzyyyxxx_show_create_function_name(int)", 
res2.get(0).get(0))
+
+    def res3 = sql """show create global function 
zzzyyyxxx_show_create_global_function_name(INT);"""
+    assertTrue(res3.size() == 1)
+    assertEquals("zzzyyyxxx_show_create_global_function_name(int)", 
res3.get(0).get(0))
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to