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 deb2fc14f5f431c..f94cc8d41a9963c 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 @@ -209,7 +209,8 @@ supportedShowStatement | SHOW STORAGE? ENGINES #showStorageEngines | SHOW CREATE MATERIALIZED VIEW mvName=identifier ON tableName=multipartIdentifier #showCreateMaterializedView - | SHOW FRONTENDS name=identifier? #showFrontends + | SHOW FRONTENDS name=identifier? #showFrontends + | SHOW TABLET STORAGE FORMAT VERBOSE? #showTabletStorageFormat ; unsupportedOtherStatement @@ -335,7 +336,6 @@ unsupportedShowStatement | SHOW CONVERT_LSC ((FROM | IN) database=multipartIdentifier)? #showConvertLsc | SHOW REPLICA STATUS FROM baseTableRef wildWhere? #showReplicaStatus | SHOW REPLICA DISTRIBUTION FROM baseTableRef #showREplicaDistribution - | SHOW TABLET STORAGE FORMAT VERBOSE? #showTabletStorageFormat | SHOW TABLET DIAGNOSIS tabletId=INTEGER_VALUE #showDiagnoseTablet | SHOW COPY ((FROM | IN) database=multipartIdentifier)? whereClause? sortClause? limitClause? #showCopy 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 b02625b1afc3104..6f9fa64154756e6 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 @@ -208,6 +208,7 @@ import org.apache.doris.nereids.DorisParser.ShowRepositoriesContext; import org.apache.doris.nereids.DorisParser.ShowRolesContext; import org.apache.doris.nereids.DorisParser.ShowStorageEnginesContext; +import org.apache.doris.nereids.DorisParser.ShowTabletStorageFormatContext; import org.apache.doris.nereids.DorisParser.ShowVariablesContext; import org.apache.doris.nereids.DorisParser.ShowViewContext; import org.apache.doris.nereids.DorisParser.SimpleColumnDefContext; @@ -447,15 +448,12 @@ import org.apache.doris.nereids.trees.plans.commands.ShowLastInsertCommand; import org.apache.doris.nereids.trees.plans.commands.ShowProcCommand; import org.apache.doris.nereids.trees.plans.commands.ShowProcedureStatusCommand; -<<<<<<< HEAD import org.apache.doris.nereids.trees.plans.commands.ShowRepositoriesCommand; import org.apache.doris.nereids.trees.plans.commands.ShowRolesCommand; import org.apache.doris.nereids.trees.plans.commands.ShowStorageEnginesCommand; +import org.apache.doris.nereids.trees.plans.commands.ShowTabletStorageFormatCommand; import org.apache.doris.nereids.trees.plans.commands.ShowVariablesCommand; import org.apache.doris.nereids.trees.plans.commands.ShowViewCommand; -======= -import org.apache.doris.nereids.trees.plans.commands.ShowTabletStorageFormatCommand; ->>>>>>> 53323bec0c ([Feat](nereids) support ShowTabletStorageFormat command in nereids #43295) import org.apache.doris.nereids.trees.plans.commands.UnsetDefaultStorageVaultCommand; import org.apache.doris.nereids.trees.plans.commands.UnsetVariableCommand; import org.apache.doris.nereids.trees.plans.commands.UnsupportedCommand; @@ -4146,4 +4144,11 @@ public LogicalPlan visitAdminShowTabletStorageFormat(AdminShowTabletStorageForma boolean verbose = ctx.VERBOSE() != null; return new ShowTabletStorageFormatCommand(verbose); } + + @Override + public LogicalPlan visitShowTabletStorageFormat(ShowTabletStorageFormatContext ctx) { + boolean verbose = ctx.VERBOSE() != null; + return new ShowTabletStorageFormatCommand(verbose); + } + } 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 6a2a082cb9415bc..fea8f1f9682bac3 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 @@ -190,7 +190,6 @@ public enum PlanType { RECOVER_DATABASE_COMMAND, RECOVER_TABLE_COMMAND, RECOVER_PARTITION_COMMAND, - REPLAY_COMMAND REPLAY_COMMAND, - ADMIN_SHOW_TABLET_STORAGE_FORMAT_COMMAND + SHOW_TABLET_STORAGE_FORMAT_COMMAND } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowTabletStorageFormatCommand.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowTabletStorageFormatCommand.java index 974c46747a12466..3cedf9d8fd40aa6 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowTabletStorageFormatCommand.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowTabletStorageFormatCommand.java @@ -17,11 +17,11 @@ package org.apache.doris.nereids.trees.plans.commands; -import org.apache.doris.analysis.StmtType; import org.apache.doris.catalog.Column; import org.apache.doris.catalog.Env; import org.apache.doris.catalog.ScalarType; import org.apache.doris.common.AnalysisException; +import org.apache.doris.common.DdlException; import org.apache.doris.common.ErrorCode; import org.apache.doris.common.ErrorReport; import org.apache.doris.mysql.privilege.PrivPredicate; @@ -43,9 +43,9 @@ import java.util.List; /** - * admin show tablet storage format command + * show tablet storage format command */ -public class ShowTabletStorageFormatCommand extends Command implements NoForward { +public class ShowTabletStorageFormatCommand extends ShowCommand { public static final Logger LOG = LogManager.getLogger(ShowTabletStorageFormatCommand.class); private final boolean verbose; @@ -53,7 +53,7 @@ public class ShowTabletStorageFormatCommand extends Command implements NoForward * constructor */ public ShowTabletStorageFormatCommand(boolean verbose) { - super(PlanType.ADMIN_SHOW_TABLET_STORAGE_FORMAT_COMMAND); + super(PlanType.SHOW_TABLET_STORAGE_FORMAT_COMMAND); this.verbose = verbose; } @@ -75,7 +75,7 @@ public ShowResultSetMetaData getMetaData() { } @Override - public void run(ConnectContext ctx, StmtExecutor executor) throws Exception { + public ShowResultSet doRun(ConnectContext ctx, StmtExecutor executor) throws Exception { if (!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(), PrivPredicate.ADMIN)) { ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR, PrivPredicate.ADMIN.getPrivs().toString()); @@ -114,8 +114,7 @@ public void run(ConnectContext ctx, StmtExecutor executor) throws Exception { } } ShowResultSetMetaData showMetaData = getMetaData(); - ShowResultSet resultSet = new ShowResultSet(showMetaData, resultRowSet); - executor.sendResultSet(resultSet); + return new ShowResultSet(showMetaData, resultRowSet); } @Override @@ -124,7 +123,8 @@ public R accept(PlanVisitor visitor, C context) { } @Override - public StmtType stmtType() { - return StmtType.SHOW; + protected void checkSupportedInCloudMode() throws DdlException { + LOG.info("show tablet storage format not supported in cloud mode"); + throw new DdlException("Unsupported operation"); } } 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 d982e06b6f4ed98..17b12453665e364 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 @@ -63,9 +63,9 @@ import org.apache.doris.nereids.trees.plans.commands.ShowRepositoriesCommand; import org.apache.doris.nereids.trees.plans.commands.ShowRolesCommand; import org.apache.doris.nereids.trees.plans.commands.ShowStorageEnginesCommand; +import org.apache.doris.nereids.trees.plans.commands.ShowTabletStorageFormatCommand; import org.apache.doris.nereids.trees.plans.commands.ShowVariablesCommand; import org.apache.doris.nereids.trees.plans.commands.ShowViewCommand; -import org.apache.doris.nereids.trees.plans.commands.ShowTabletStorageFormatCommand; import org.apache.doris.nereids.trees.plans.commands.UnsetDefaultStorageVaultCommand; import org.apache.doris.nereids.trees.plans.commands.UnsetVariableCommand; import org.apache.doris.nereids.trees.plans.commands.UnsupportedCommand; @@ -251,7 +251,6 @@ default R visitSetDefaultStorageVault(SetDefaultStorageVaultCommand setDefaultSt return visitCommand(setDefaultStorageVaultCommand, context); } -<<<<<<< HEAD default R visitShowLastInsertCommand(ShowLastInsertCommand showLastInsertCommand, C context) { return visitCommand(showLastInsertCommand, context); } @@ -299,10 +298,10 @@ default R visitRecoverDatabaseCommand(RecoverDatabaseCommand recoverDatabaseComm default R visitDropRoleCommand(DropRoleCommand dropRoleCommand, C context) { return visitCommand(dropRoleCommand, context); -======= + } + default R visitShowTabletStorageFormatCommand(ShowTabletStorageFormatCommand showTabletStorageFormatCommand, C context) { return visitCommand(showTabletStorageFormatCommand, context); ->>>>>>> 53323bec0c ([Feat](nereids) support ShowTabletStorageFormat command in nereids #43295) } }