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 b7fa04c2ef796fb..59d7024eb7a6c05 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 @@ -192,6 +192,7 @@ supportedDropStatement supportedShowStatement : SHOW (GLOBAL | SESSION | LOCAL)? VARIABLES wildWhere? #showVariables + | SHOW AUTHORS #showAuthors | SHOW VIEW (FROM |IN) tableName=multipartIdentifier ((FROM | IN) database=identifier)? #showView @@ -243,7 +244,6 @@ unsupportedShowStatement | SHOW EVENTS ((FROM | IN) database=multipartIdentifier)? wildWhere? #showEvents | SHOW PLUGINS #showPlugins | SHOW STORAGE? ENGINES #showStorageEngines - | SHOW AUTHORS #showAuthors | SHOW BRIEF? CREATE TABLE name=multipartIdentifier #showCreateTable | SHOW CREATE VIEW name=multipartIdentifier #showCreateView | SHOW CREATE MATERIALIZED VIEW name=multipartIdentifier #showMaterializedView 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 8362d002d2b8135..9f7b43aa8cb72d1 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 @@ -191,6 +191,7 @@ import org.apache.doris.nereids.DorisParser.SetUserPropertiesContext; import org.apache.doris.nereids.DorisParser.SetUserVariableContext; import org.apache.doris.nereids.DorisParser.SetVariableWithTypeContext; +import org.apache.doris.nereids.DorisParser.ShowAuthorsContext; import org.apache.doris.nereids.DorisParser.ShowConfigContext; import org.apache.doris.nereids.DorisParser.ShowConstraintContext; import org.apache.doris.nereids.DorisParser.ShowCreateMTMVContext; @@ -422,6 +423,7 @@ import org.apache.doris.nereids.trees.plans.commands.SetOptionsCommand; import org.apache.doris.nereids.trees.plans.commands.SetTransactionCommand; import org.apache.doris.nereids.trees.plans.commands.SetUserPropertiesCommand; +import org.apache.doris.nereids.trees.plans.commands.ShowAuthorsCommand; import org.apache.doris.nereids.trees.plans.commands.ShowConfigCommand; import org.apache.doris.nereids.trees.plans.commands.ShowConstraintsCommand; import org.apache.doris.nereids.trees.plans.commands.ShowCreateMTMVCommand; @@ -3879,6 +3881,11 @@ public LogicalPlan visitCreateTableLike(CreateTableLikeContext ctx) { return new CreateTableLikeCommand(info); } + @Override + public LogicalPlan visitShowAuthors(ShowAuthorsContext ctx) { + return new ShowAuthorsCommand(); + } + @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 b9fb9e96f879272..573b81a7578e9bf 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 @@ -177,6 +177,7 @@ public enum PlanType { EXECUTE_COMMAND, SHOW_CONFIG_COMMAND, SHOW_VARIABLES_COMMAND, + SHOW_AUTHORS_COMMAND, SHOW_VIEW_COMMAND, REPLAY_COMMAND } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowAuthorsCommand.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowAuthorsCommand.java new file mode 100644 index 000000000000000..3154517b5ac60f3 --- /dev/null +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowAuthorsCommand.java @@ -0,0 +1,56 @@ +// 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; + +/** + * ShowAuthorsCommand + */ +public class ShowAuthorsCommand extends ShowCommand { + private static final ShowResultSetMetaData META_DATA = + ShowResultSetMetaData.builder() + .addColumn(new Column("Name", ScalarType.createVarchar(30))) + .addColumn(new Column("Location", ScalarType.createVarchar(30))) + .addColumn(new Column("Comment", ScalarType.createVarchar(30))) + .build(); + + public ShowAuthorsCommand() { + super(PlanType.SHOW_AUTHORS_COMMAND); + } + + @Override + public R accept(PlanVisitor visitor, C context) { + return visitor.visitShowAuthorsCommand(this, context); + } + + @Override + public ShowResultSet doRun(ConnectContext ctx, StmtExecutor executor) throws Exception { + List> rowSet = Lists.newArrayList(); + return new ShowResultSet(META_DATA, rowSet); + } +} 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 e89c9a3a5c5f1c6..ab1ed7aecf452ba 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 @@ -47,6 +47,7 @@ import org.apache.doris.nereids.trees.plans.commands.SetOptionsCommand; import org.apache.doris.nereids.trees.plans.commands.SetTransactionCommand; import org.apache.doris.nereids.trees.plans.commands.SetUserPropertiesCommand; +import org.apache.doris.nereids.trees.plans.commands.ShowAuthorsCommand; import org.apache.doris.nereids.trees.plans.commands.ShowConfigCommand; import org.apache.doris.nereids.trees.plans.commands.ShowConstraintsCommand; import org.apache.doris.nereids.trees.plans.commands.ShowCreateMTMVCommand; @@ -215,6 +216,10 @@ default R visitCreateTableLikeCommand(CreateTableLikeCommand createTableLikeComm return visitCommand(createTableLikeCommand, context); } + default R visitShowAuthorsCommand(ShowAuthorsCommand showAuthorsCommand, C context) { + return visitCommand(showAuthorsCommand, context); + } + default R visitShowConfigCommand(ShowConfigCommand showConfigCommand, C context) { return visitCommand(showConfigCommand, context); } diff --git a/regression-test/data/nereids_p0/ddl/show_authors/show_authors.out b/regression-test/data/nereids_p0/ddl/show_authors/show_authors.out new file mode 100644 index 000000000000000..5629a2aa80f679f --- /dev/null +++ b/regression-test/data/nereids_p0/ddl/show_authors/show_authors.out @@ -0,0 +1,3 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !cmd -- + diff --git a/regression-test/suites/nereids_p0/ddl/show_authors/show_authors.groovy b/regression-test/suites/nereids_p0/ddl/show_authors/show_authors.groovy new file mode 100644 index 000000000000000..8d00205a5cb93af --- /dev/null +++ b/regression-test/suites/nereids_p0/ddl/show_authors/show_authors.groovy @@ -0,0 +1,21 @@ +// 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("show_authors_command") { + checkNereidsExecute("""show authors;""") + qt_cmd("""show authors;""") +}