This is an automated email from the ASF dual-hosted git repository.
starocean999 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new ec4425bebf5 [improvment](show) support baseindexname and
rollupindexname in show alter table mv (#53064)
ec4425bebf5 is described below
commit ec4425bebf5e7999e008ab39862970f086eeeb8f
Author: lsy3993 <[email protected]>
AuthorDate: Fri Jul 11 10:00:23 2025 +0800
[improvment](show) support baseindexname and rollupindexname in show alter
table mv (#53064)
Related PR: #51562
Problem Summary:
the result of statement `show alter table materialized view from
your_db_name` like this :
```
*************************** 1. row ***************************
JobId: 1752144553443
TableName: test_show_alter_table_tbl
CreateTime: 2025-07-10 18:51:38
FinishTime: 2025-07-10 18:51:39
BaseIndexName: test_show_alter_table_tbl
RollupIndexName: a_mv
RollupId: 1752144553444
TransactionId: 8
State: FINISHED
Msg:
Progress: NULL
Timeout: 2592000
```
but when you execute `show alter table materialized view from
your_db_name where BaseIndexName = 'test_show_alter_table_tbl'`, you
will get this error:
`The columns of TableName/IndexName/CreateTime/FinishTime/State are
supported.`
Why BaseIndexName in where clause is not supported even if the result
contains **BaseIndexName**?
So we should support it.
---
.../nereids/trees/plans/commands/ShowAlterTableCommand.java | 9 +++++++--
.../trees/plans/commands/ShowAlterTableCommandTest.java | 10 ++++++++++
.../nereids_p0/show/test_nereids_show_alter_table.groovy | 10 ++++++++++
3 files changed, 27 insertions(+), 2 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowAlterTableCommand.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowAlterTableCommand.java
index c4580c89ff1..656c3643489 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowAlterTableCommand.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowAlterTableCommand.java
@@ -89,6 +89,9 @@ public class ShowAlterTableCommand extends ShowCommand {
private static String INDEX_NAME = "indexname";
private static String CREATE_TIME = "createtime";
private static String FINISH_TIME = "finishtime";
+ private static String BASE_INDEX_NAME = "baseindexname";
+ private static String ROLLUP_INDEX_NAME = "rollupindexname";
+
private AlterType type;
private String dbName;
private Expression whereClause;
@@ -124,7 +127,8 @@ public class ShowAlterTableCommand extends ShowCommand {
throw new AnalysisException("Only support column = xxx syntax.");
}
String leftKey = ((UnboundSlot)
subExpr.child(0)).getName().toLowerCase();
- if (leftKey.equals(TABLE_NAME) || leftKey.equals(STATE) ||
leftKey.equals(INDEX_NAME)) {
+ if (leftKey.equals(TABLE_NAME) || leftKey.equals(STATE) ||
leftKey.equals(INDEX_NAME)
+ || leftKey.equals(BASE_INDEX_NAME) ||
leftKey.equals(ROLLUP_INDEX_NAME)) {
if (!(subExpr.child(1) instanceof StringLikeLiteral) ||
!(binaryPredicate instanceof EqualTo)) {
throw new AnalysisException("Where clause : TableName =
\"table1\" or "
+ "State =
\"FINISHED|CANCELLED|RUNNING|PENDING|WAITING_TXN\"");
@@ -140,7 +144,8 @@ public class ShowAlterTableCommand extends ShowCommand {
subExpr = subExpr.withChildren(left, right);
} else {
throw new AnalysisException(
- "The columns of
TableName/IndexName/CreateTime/FinishTime/State are supported.");
+ "The columns of
TableName/IndexName/CreateTime/FinishTime/State/BaseIndexName/RollupIndexName "
+ + "are supported.");
}
filterMap.put(leftKey.toLowerCase(), isNotExpr ? new Not(subExpr) :
subExpr);
}
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/ShowAlterTableCommandTest.java
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/ShowAlterTableCommandTest.java
index a03706336eb..a1bfc8f033b 100644
---
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/ShowAlterTableCommandTest.java
+++
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/commands/ShowAlterTableCommandTest.java
@@ -169,5 +169,15 @@ public class ShowAlterTableCommandTest extends
TestWithFeService {
new StringLiteral("2025-06-04 21:53:53"));
sa1 = new ShowAlterTableCommand("test", where20, null, 1, 0,
ShowAlterTableCommand.AlterType.MV);
sa1.handleShowAlterTable(connectContext, null);
+
+ Expression where21 = new EqualTo(new
UnboundSlot(Lists.newArrayList("BaseIndexName")),
+ new StringLiteral("abc"));
+ sa1 = new ShowAlterTableCommand("test", where21, null, 1, 0,
ShowAlterTableCommand.AlterType.MV);
+ sa1.handleShowAlterTable(connectContext, null);
+
+ Expression where22 = new EqualTo(new
UnboundSlot(Lists.newArrayList("RollupIndexName")),
+ new StringLiteral("abc"));
+ sa1 = new ShowAlterTableCommand("test", where22, null, 1, 0,
ShowAlterTableCommand.AlterType.MV);
+ sa1.handleShowAlterTable(connectContext, null);
}
}
diff --git
a/regression-test/suites/nereids_p0/show/test_nereids_show_alter_table.groovy
b/regression-test/suites/nereids_p0/show/test_nereids_show_alter_table.groovy
index 93f6d057181..f201e37f7b1 100644
---
a/regression-test/suites/nereids_p0/show/test_nereids_show_alter_table.groovy
+++
b/regression-test/suites/nereids_p0/show/test_nereids_show_alter_table.groovy
@@ -66,6 +66,8 @@ suite("test_nereids_show_alter_table") {
checkNereidsExecute("show alter table materialized view from
test_show_alter_table_db where CreateTime > '2025-06-05 22:48:08';")
checkNereidsExecute("show alter table materialized view from
test_show_alter_table_db where CreateTime <= '2025-06-05 22:48:08';")
checkNereidsExecute("show alter table materialized view from
test_show_alter_table_db where CreateTime < '2025-06-05 22:48:08';")
+ checkNereidsExecute("show alter table materialized view from
test_show_alter_table_db where BaseIndexName = 'test_show_alter_table_tbl';")
+ checkNereidsExecute("show alter table materialized view from
test_show_alter_table_db where RollupIndexName = 'a_mv';")
checkNereidsExecute("show alter table column from
test_show_alter_table_db;")
checkNereidsExecute("show alter table column from test_show_alter_table_db
where TableName = 'table_right1';")
@@ -108,6 +110,14 @@ suite("test_nereids_show_alter_table") {
assertEquals(1, res7.size())
assertEquals("test_show_alter_table_tbl1", res7.get(0).get(1))
+ def res8 = sql """show alter table materialized view from
test_show_alter_table_db where BaseIndexName = 'test_show_alter_table_tbl';"""
+ assertEquals(2, res8.size())
+ assertEquals("test_show_alter_table_tbl", res8.get(0).get(1))
+
+ def res9 = sql """show alter table materialized view from
test_show_alter_table_db where RollupIndexName = 'a_mv';"""
+ assertEquals(1, res9.size())
+ assertEquals("a_mv", res9.get(0).get(5))
+
assertThrows(Exception.class, {
sql """show alter table materialized view from
test_show_alter_table_db where JobId = 1749041691284;"""
})
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]