You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2026/05/22 06:22:04 UTC
(doris) branch branch-4.1 updated: branch-4.1: [fix](fe) Allow show tablet without selected database #63280 (#63512)
This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.1 by this push:
new 4da4d131801 branch-4.1: [fix](fe) Allow show tablet without selected database #63280 (#63512)
4da4d131801 is described below
commit 4da4d1318014fb5da279281dbaa830f524937d12
Author: github-actions[bot] <41...@users.noreply.github.com>
AuthorDate: Fri May 22 14:21:56 2026 +0800
branch-4.1: [fix](fe) Allow show tablet without selected database #63280 (#63512)
Cherry-picked from #63280
Co-authored-by: minghong <zh...@selectdb.com>
---
.../doris/nereids/trees/plans/commands/ShowTabletIdCommand.java | 7 -------
.../nereids/trees/plans/commands/ShowTabletIdCommandTest.java | 4 ++--
regression-test/suites/show_p0/test_show_tablet.groovy | 8 +++++++-
3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowTabletIdCommand.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowTabletIdCommand.java
index 15d83237816..a311ad5404f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowTabletIdCommand.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowTabletIdCommand.java
@@ -46,7 +46,6 @@ import org.apache.doris.qe.StmtExecutor;
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;
@@ -56,7 +55,6 @@ import java.util.List;
*/
public class ShowTabletIdCommand extends ShowCommand {
private final long tabletId;
- private String dbName;
/**
* constructor
@@ -97,11 +95,6 @@ public class ShowTabletIdCommand extends ShowCommand {
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() {
diff --git a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/ShowTabletIdCommandTest.java b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/ShowTabletIdCommandTest.java
index 46e9541231f..3fda30231ff 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/ShowTabletIdCommandTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/ShowTabletIdCommandTest.java
@@ -78,9 +78,9 @@ public class ShowTabletIdCommandTest {
}
@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));
}
}
diff --git a/regression-test/suites/show_p0/test_show_tablet.groovy b/regression-test/suites/show_p0/test_show_tablet.groovy
index 024e90fdd19..abe54d7e93f 100644
--- a/regression-test/suites/show_p0/test_show_tablet.groovy
+++ b/regression-test/suites/show_p0/test_show_tablet.groovy
@@ -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;"""
@@ -53,4 +59,4 @@ suite("test_show_tablet") {
} else {
assertTrue(1 == 2)
}
-}
\ No newline at end of file
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org