This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new d2ad5cac2c6 branch-4.0: [fix](fe) Allow show tablet without selected
database #63280 (#63513)
d2ad5cac2c6 is described below
commit d2ad5cac2c629b551d03341f976158776b8175c3
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri May 22 14:22:32 2026 +0800
branch-4.0: [fix](fe) Allow show tablet without selected database #63280
(#63513)
Cherry-picked from #63280
Co-authored-by: minghong <[email protected]>
---
.../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: [email protected]
For additional commands, e-mail: [email protected]