Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.apache.doris.statistics.query.QueryStatsUtil;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;

import java.util.List;
Expand All @@ -56,7 +55,6 @@
*/
public class ShowTabletIdCommand extends ShowCommand {
private final long tabletId;
private String dbName;

/**
* constructor
Expand Down Expand Up @@ -97,11 +95,6 @@ protected void validate(ConnectContext ctx) throws AnalysisException {
if (!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(), PrivPredicate.ADMIN)) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR, "SHOW TABLET");
}

dbName = ctx.getDatabase();
if (Strings.isNullOrEmpty(dbName)) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_NO_DB_ERROR);
}
}

private ShowResultSet handleShowTabletId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ void noGlobalPriv() {
}

@Test
void dbIsEmpty() {
void noDatabaseSelected() {
runBefore("", true);
ShowTabletIdCommand command = new ShowTabletIdCommand(CatalogMocker.TEST_TBL_ID);
Assertions.assertThrows(AnalysisException.class, () -> command.validate(ctx));
Assertions.assertDoesNotThrow(() -> command.validate(ctx));
}
}
8 changes: 7 additions & 1 deletion regression-test/suites/show_p0/test_show_tablet.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ suite("test_show_tablet") {
);"""

def res = sql """ SHOW TABLETS FROM show_tablets_test_t """
def noDbJdbcUrl = context.config.jdbcUrl.replaceFirst(/(jdbc:mysql:\/\/[^\/]+\/)[^?]*/, '$1')
connect(context.config.jdbcUser, context.config.jdbcPassword, noDbJdbcUrl) {
def tabletId = res[0][0]
def tabletRes = sql """ SHOW TABLET ${tabletId} """
assertTrue(tabletRes.size() == 1)
}
if (res.size() == 5) {
// replication num == 1
res = sql """SHOW TABLETS FROM show_tablets_test_t limit 5, 1;"""
Expand All @@ -53,4 +59,4 @@ suite("test_show_tablet") {
} else {
assertTrue(1 == 2)
}
}
}
Loading