This is an automated email from the ASF dual-hosted git repository.
morrySnow 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 ff39352734a [opt](compatibility) add SHOW FUNCTION/PROCEDURE STATUS
SQL to compatiable with MySQL (#66659)
ff39352734a is described below
commit ff39352734a9f301332aeddedc092dfe110384b5
Author: yujun <[email protected]>
AuthorDate: Thu Aug 13 14:07:43 2026 +0800
[opt](compatibility) add SHOW FUNCTION/PROCEDURE STATUS SQL to compatiable
with MySQL (#66659)
### What problem does this PR solve?
Problem Summary: PL/SQL stored procedures were removed in #58700 because
the implementation had many bugs. That removal also deleted the `SHOW
(PROCEDURE|FUNCTION) STATUS` grammar, the `ShowProcedureStatusCommand`,
and the `information_schema.routines` scanner. Clients such as Bytebase
send `SHOW FUNCTION STATUS WHERE Db = '...'` during connection/metadata
probing, and the unsupported syntax now blocks users from using the
database.
This PR only restores the SQL entry points so these statements parse and
always return empty result sets without errors. The stored procedure
functionality itself is NOT restored.
Related PR: #58700
---
.../information_schema/schema_routine_scanner.cpp | 71 ++++++++++++++++++++++
be/src/information_schema/schema_routine_scanner.h | 42 +++++++++++++
be/src/information_schema/schema_scanner.cpp | 3 +
.../doris/nereids/parser/LogicalPlanBuilder.java | 7 +++
.../apache/doris/nereids/trees/plans/PlanType.java | 1 +
.../plans/commands/ShowProcedureStatusCommand.java | 67 ++++++++++++++++++++
.../trees/plans/visitor/CommandVisitor.java | 5 ++
.../antlr4/org/apache/doris/nereids/DorisParser.g4 | 1 +
.../test_show_procedure_function_status.out | 15 +++++
.../test_show_procedure_function_status.groovy | 26 ++++++++
10 files changed, 238 insertions(+)
diff --git a/be/src/information_schema/schema_routine_scanner.cpp
b/be/src/information_schema/schema_routine_scanner.cpp
new file mode 100644
index 00000000000..3b38b8f5dd4
--- /dev/null
+++ b/be/src/information_schema/schema_routine_scanner.cpp
@@ -0,0 +1,71 @@
+// 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.
+
+#include "information_schema/schema_routine_scanner.h"
+
+#include <vector>
+
+#include "common/status.h"
+#include "core/block/block.h"
+#include "core/string_ref.h"
+#include "runtime/runtime_state.h"
+
+namespace doris {
+class RuntimeState;
+class Block;
+
+std::vector<SchemaScanner::ColumnDesc> SchemaRoutinesScanner::_s_tbls_columns
= {
+ {"SPECIFIC_NAME", TYPE_VARCHAR, sizeof(StringRef), true},
+ {"ROUTINE_CATALOG", TYPE_VARCHAR, sizeof(StringRef), true},
+ {"ROUTINE_SCHEMA", TYPE_VARCHAR, sizeof(StringRef), true},
+ {"ROUTINE_NAME", TYPE_VARCHAR, sizeof(StringRef), true},
+ {"ROUTINE_TYPE", TYPE_VARCHAR, sizeof(StringRef), true},
+ {"DTD_IDENTIFIER", TYPE_VARCHAR, sizeof(StringRef), true},
+ {"ROUTINE_BODY", TYPE_VARCHAR, sizeof(StringRef), true},
+ {"ROUTINE_DEFINITION", TYPE_VARCHAR, sizeof(StringRef), true},
+ {"EXTERNAL_NAME", TYPE_VARCHAR, sizeof(StringRef), true},
+ {"EXTERNAL_LANGUAGE", TYPE_VARCHAR, sizeof(StringRef), true},
+ {"PARAMETER_STYLE", TYPE_VARCHAR, sizeof(StringRef), true},
+ {"IS_DETERMINISTIC", TYPE_VARCHAR, sizeof(StringRef), true},
+ {"SQL_DATA_ACCESS", TYPE_VARCHAR, sizeof(StringRef), true},
+ {"SQL_PATH", TYPE_VARCHAR, sizeof(StringRef), true},
+ {"SECURITY_TYPE", TYPE_VARCHAR, sizeof(StringRef), true},
+ {"CREATED", TYPE_DATETIME, sizeof(int64_t), true},
+ {"LAST_ALTERED", TYPE_DATETIME, sizeof(int64_t), true},
+ {"SQL_MODE", TYPE_VARCHAR, sizeof(StringRef), true},
+ {"ROUTINE_COMMENT", TYPE_VARCHAR, sizeof(StringRef), true},
+ {"DEFINER", TYPE_VARCHAR, sizeof(StringRef), true},
+ {"CHARACTER_SET_CLIENT", TYPE_VARCHAR, sizeof(StringRef), true},
+ {"COLLATION_CONNECTION", TYPE_VARCHAR, sizeof(StringRef), true},
+ {"DATABASE_COLLATION", TYPE_VARCHAR, sizeof(StringRef), true},
+};
+
+SchemaRoutinesScanner::SchemaRoutinesScanner()
+ : SchemaScanner(_s_tbls_columns, TSchemaTableType::SCH_PROCEDURES) {}
+
+SchemaRoutinesScanner::~SchemaRoutinesScanner() {}
+
+Status SchemaRoutinesScanner::start(RuntimeState* state) {
+ return Status::OK();
+}
+
+Status SchemaRoutinesScanner::get_next_block_internal(Block* block, bool* eos)
{
+ *eos = true;
+ return Status::OK();
+}
+
+} // namespace doris
diff --git a/be/src/information_schema/schema_routine_scanner.h
b/be/src/information_schema/schema_routine_scanner.h
new file mode 100644
index 00000000000..cc85dc85842
--- /dev/null
+++ b/be/src/information_schema/schema_routine_scanner.h
@@ -0,0 +1,42 @@
+// 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.
+
+#pragma once
+
+#include <vector>
+
+#include "common/status.h"
+#include "information_schema/schema_scanner.h"
+
+namespace doris {
+class RuntimeState;
+class Block;
+
+class SchemaRoutinesScanner : public SchemaScanner {
+ ENABLE_FACTORY_CREATOR(SchemaRoutinesScanner);
+
+public:
+ SchemaRoutinesScanner();
+ ~SchemaRoutinesScanner() override;
+
+ Status start(RuntimeState* state) override;
+ Status get_next_block_internal(Block* block, bool* eos) override;
+
+ static std::vector<SchemaScanner::ColumnDesc> _s_tbls_columns;
+};
+
+} // namespace doris
diff --git a/be/src/information_schema/schema_scanner.cpp
b/be/src/information_schema/schema_scanner.cpp
index b3229b74827..bfc0b6e140e 100644
--- a/be/src/information_schema/schema_scanner.cpp
+++ b/be/src/information_schema/schema_scanner.cpp
@@ -71,6 +71,7 @@
#include "information_schema/schema_profiling_scanner.h"
#include "information_schema/schema_role_mappings_scanner.h"
#include "information_schema/schema_routine_load_job_scanner.h"
+#include "information_schema/schema_routine_scanner.h"
#include "information_schema/schema_rowsets_scanner.h"
#include "information_schema/schema_schema_privileges_scanner.h"
#include "information_schema/schema_schemata_scanner.h"
@@ -246,6 +247,8 @@ std::unique_ptr<SchemaScanner>
SchemaScanner::create(TSchemaTableType::type type
return SchemaWorkloadGroupsScanner::create_unique();
case TSchemaTableType::SCH_PROCESSLIST:
return SchemaProcessListScanner::create_unique();
+ case TSchemaTableType::SCH_PROCEDURES:
+ return SchemaRoutinesScanner::create_unique();
case TSchemaTableType::SCH_USER:
return SchemaUserScanner::create_unique();
case TSchemaTableType::SCH_WORKLOAD_POLICY:
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 0912f8dcccf..8663577809f 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
@@ -418,6 +418,7 @@ import
org.apache.doris.nereids.DorisParser.ShowPartitionsContext;
import org.apache.doris.nereids.DorisParser.ShowPluginsContext;
import org.apache.doris.nereids.DorisParser.ShowPrivilegesContext;
import org.apache.doris.nereids.DorisParser.ShowProcContext;
+import org.apache.doris.nereids.DorisParser.ShowProcedureStatusContext;
import org.apache.doris.nereids.DorisParser.ShowProcessListContext;
import org.apache.doris.nereids.DorisParser.ShowQueryProfileContext;
import org.apache.doris.nereids.DorisParser.ShowQueryStatsContext;
@@ -855,6 +856,7 @@ import
org.apache.doris.nereids.trees.plans.commands.ShowPartitionsCommand;
import org.apache.doris.nereids.trees.plans.commands.ShowPluginsCommand;
import org.apache.doris.nereids.trees.plans.commands.ShowPrivilegesCommand;
import org.apache.doris.nereids.trees.plans.commands.ShowProcCommand;
+import
org.apache.doris.nereids.trees.plans.commands.ShowProcedureStatusCommand;
import org.apache.doris.nereids.trees.plans.commands.ShowProcessListCommand;
import org.apache.doris.nereids.trees.plans.commands.ShowPythonPackagesCommand;
import org.apache.doris.nereids.trees.plans.commands.ShowPythonVersionsCommand;
@@ -5755,6 +5757,11 @@ public class LogicalPlanBuilder extends
DorisParserBaseVisitor<Object> {
return new ShowExportCommand(ctlName, dbName, wildWhere, orderKeys,
limit);
}
+ @Override
+ public LogicalPlan visitShowProcedureStatus(ShowProcedureStatusContext
ctx) {
+ return ParserUtils.withOrigin(ctx, () -> new
ShowProcedureStatusCommand());
+ }
+
@Override
public LogicalPlan visitShowConfig(ShowConfigContext ctx) {
ShowConfigCommand command;
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 1bda72be3d4..c73396d1271 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
@@ -213,6 +213,7 @@ public enum PlanType {
CANCEL_WARM_UP_JOB_COMMAND,
CANCEL_MTMV_TASK_COMMAND,
CALL_COMMAND,
+ SHOW_PROCEDURE_COMMAND,
DROP_ROLE_COMMAND,
DROP_REPOSITOORY_COMMAND,
CREATE_VIEW_COMMAND,
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowProcedureStatusCommand.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowProcedureStatusCommand.java
new file mode 100644
index 00000000000..aafa2817938
--- /dev/null
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowProcedureStatusCommand.java
@@ -0,0 +1,67 @@
+// 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.catalog.Column;
+import org.apache.doris.catalog.ScalarType;
+import org.apache.doris.nereids.trees.plans.PlanType;
+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.collect.Lists;
+
+/**
+ * show procedure status command.
+ * PL/SQL stored procedures are removed, this command only keeps the SQL entry
+ * for client compatibility and always returns an empty result set.
+ */
+public class ShowProcedureStatusCommand extends ShowCommand {
+ private static final ShowResultSetMetaData META_DATA =
+ ShowResultSetMetaData.builder()
+ .addColumn(new Column("ProcedureName",
ScalarType.createStringType()))
+ .addColumn(new Column("CatalogId",
ScalarType.createStringType()))
+ .addColumn(new Column("DbId",
ScalarType.createStringType()))
+ .addColumn(new Column("DbName",
ScalarType.createStringType()))
+ .addColumn(new Column("PackageName",
ScalarType.createStringType()))
+ .addColumn(new Column("OwnerName",
ScalarType.createStringType()))
+ .addColumn(new Column("CreateTime",
ScalarType.createStringType()))
+ .addColumn(new Column("ModifyTime",
ScalarType.createStringType()))
+ .build();
+
+ public ShowProcedureStatusCommand() {
+ super(PlanType.SHOW_PROCEDURE_COMMAND);
+ }
+
+ @Override
+ public ShowResultSetMetaData getMetaData() {
+ return META_DATA;
+ }
+
+ @Override
+ public ShowResultSet doRun(ConnectContext ctx, StmtExecutor executor)
throws Exception {
+ return new ShowResultSet(getMetaData(), Lists.newArrayList());
+ }
+
+ @Override
+ public <R, C> R accept(PlanVisitor<R, C> visitor, C context) {
+ return visitor.visitShowProcedureStatusCommand(this, context);
+ }
+}
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 b0da1e801cc..4694998385a 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
@@ -238,6 +238,7 @@ import
org.apache.doris.nereids.trees.plans.commands.ShowPartitionsCommand;
import org.apache.doris.nereids.trees.plans.commands.ShowPluginsCommand;
import org.apache.doris.nereids.trees.plans.commands.ShowPrivilegesCommand;
import org.apache.doris.nereids.trees.plans.commands.ShowProcCommand;
+import
org.apache.doris.nereids.trees.plans.commands.ShowProcedureStatusCommand;
import org.apache.doris.nereids.trees.plans.commands.ShowProcessListCommand;
import org.apache.doris.nereids.trees.plans.commands.ShowPythonPackagesCommand;
import org.apache.doris.nereids.trees.plans.commands.ShowPythonVersionsCommand;
@@ -777,6 +778,10 @@ public interface CommandVisitor<R, C> {
return visitCommand(showProcCommand, context);
}
+ default R visitShowProcedureStatusCommand(ShowProcedureStatusCommand
showProcedureStatusCommand, C context) {
+ return visitCommand(showProcedureStatusCommand, context);
+ }
+
default R visitShowDataCommand(ShowDataCommand showDataCommand, C context)
{
return visitCommand(showDataCommand, context);
}
diff --git
a/fe/fe-sql-parser/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
b/fe/fe-sql-parser/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
index 9dfd4630ed8..4e149e29e0a 100644
--- a/fe/fe-sql-parser/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
+++ b/fe/fe-sql-parser/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
@@ -40,6 +40,7 @@ expressionWithEof
statement
: statementBase # statementBaseAlias
| CALL name=multipartIdentifier LEFT_PAREN (expression (COMMA
expression)*)? RIGHT_PAREN #callProcedure
+ | SHOW (PROCEDURE | FUNCTION) STATUS (LIKE pattern=valueExpression |
whereClause)? #showProcedureStatus
// FIXME: like should be wildWhere? FRONTEND should not contain FROM
backendid
| ADMIN? SHOW type=(FRONTEND | BACKEND) CONFIG (LIKE
pattern=valueExpression)? (FROM backendId=INTEGER_VALUE)? #showConfig
;
diff --git
a/regression-test/data/show_p0/test_show_procedure_function_status.out
b/regression-test/data/show_p0/test_show_procedure_function_status.out
new file mode 100644
index 00000000000..924d7bc1347
--- /dev/null
+++ b/regression-test/data/show_p0/test_show_procedure_function_status.out
@@ -0,0 +1,15 @@
+-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !show_procedure_status --
+
+-- !show_procedure_status_where --
+
+-- !show_procedure_status_like --
+
+-- !show_function_status --
+
+-- !show_function_status_where --
+
+-- !show_function_status_like --
+
+-- !routines --
+
diff --git
a/regression-test/suites/show_p0/test_show_procedure_function_status.groovy
b/regression-test/suites/show_p0/test_show_procedure_function_status.groovy
new file mode 100644
index 00000000000..d8c6b16f4c3
--- /dev/null
+++ b/regression-test/suites/show_p0/test_show_procedure_function_status.groovy
@@ -0,0 +1,26 @@
+// 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_show_procedure_function_status") {
+ qt_show_procedure_status """SHOW PROCEDURE STATUS;"""
+ qt_show_procedure_status_where """SHOW PROCEDURE STATUS WHERE Db =
'data_warehouse_ods';"""
+ qt_show_procedure_status_like """SHOW PROCEDURE STATUS LIKE 'test';"""
+ qt_show_function_status """SHOW FUNCTION STATUS;"""
+ qt_show_function_status_where """SHOW FUNCTION STATUS WHERE Db =
'data_warehouse_ods';"""
+ qt_show_function_status_like """SHOW FUNCTION STATUS LIKE 'test';"""
+ qt_routines """SELECT * FROM information_schema.routines;"""
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]