Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
rijeshkp committed Nov 17, 2024
1 parent 543b56c commit 730a7ce
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -43,17 +43,17 @@
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;

/**
* constructor
*/
public ShowTabletStorageFormatCommand(boolean verbose) {
super(PlanType.ADMIN_SHOW_TABLET_STORAGE_FORMAT_COMMAND);
super(PlanType.SHOW_TABLET_STORAGE_FORMAT_COMMAND);
this.verbose = verbose;
}

Expand All @@ -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());
Expand Down Expand Up @@ -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
Expand All @@ -124,7 +123,8 @@ public <R, C> R accept(PlanVisitor<R, C> 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");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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)
}
}

0 comments on commit 730a7ce

Please sign in to comment.