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 8fa9677d32d branch-4.0: [fix](nereids)forbid create sync mv based on
annother sync mv #56912 (#56957)
8fa9677d32d is described below
commit 8fa9677d32d08ec6437ae96cb13b315d1bf12858
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Oct 18 11:07:08 2025 +0800
branch-4.0: [fix](nereids)forbid create sync mv based on annother sync mv
#56912 (#56957)
Cherry-picked from #56912
Co-authored-by: starocean999 <[email protected]>
---
.../trees/plans/commands/CreateMaterializedViewCommand.java | 3 +++
.../suites/mv_p0/test_create_mv/test_create_mv.groovy | 12 ++++++++++++
2 files changed, 15 insertions(+)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CreateMaterializedViewCommand.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CreateMaterializedViewCommand.java
index 017fcd524d5..2ad3291681d 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CreateMaterializedViewCommand.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/CreateMaterializedViewCommand.java
@@ -271,6 +271,9 @@ public class CreateMaterializedViewCommand extends Command
implements ForwardWit
if (olapTable.isTemporary()) {
throw new AnalysisException("do not support create
materialized view on temporary table");
}
+ if (olapScan.isDirectMvScan()) {
+ throw new AnalysisException("do not support create
materialized view on another synchronized mv");
+ }
validateContext.baseIndexName = olapTable.getName();
validateContext.dbName = olapTable.getDBName();
validateContext.keysType = olapTable.getKeysType();
diff --git a/regression-test/suites/mv_p0/test_create_mv/test_create_mv.groovy
b/regression-test/suites/mv_p0/test_create_mv/test_create_mv.groovy
index ac76978043e..edbbc6093d5 100644
--- a/regression-test/suites/mv_p0/test_create_mv/test_create_mv.groovy
+++ b/regression-test/suites/mv_p0/test_create_mv/test_create_mv.groovy
@@ -85,4 +85,16 @@ suite("test_create_mv") {
}
}
}
+ multi_sql """
+ drop table if exists t_mv_on_mv;
+ create table t_mv_on_mv( id int, value int)
+ partition by range(id)( partition p1 values[('1'), ('2')),
partition p2 values[('2'), ('3')), partition p3 values[('3'), ('4')),
partition p4 values[('4'), ('5')), partition p5 values[('5'),
('6')))distributed by hash(id)properties( 'replication_num'='1');
+
+ insert into t_mv_on_mv values (1, 1), (1, 2),(2, 1), (2, 2), (3, 1),
(3, 2),(4, 1), (4, 2),(5, 1), (5, 2);
+ """
+ createMV("""CREATE MATERIALIZED VIEW mv1 as select id as col1, sum(value)
as col2 from t_mv_on_mv group by id;""")
+ test {
+ sql """CREATE MATERIALIZED VIEW mv2 as select col1 as aa, count(col2)
as bb from t_mv_on_mv index mv1 group by col1; """
+ exception "do not support create materialized view on another
synchronized mv"
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]