branch-4.0:[feature](mtmv)MTMV refresh support multi pct tables#58140
Merged
yiguolei merged 8 commits intoapache:branch-4.0from Nov 20, 2025
Merged
branch-4.0:[feature](mtmv)MTMV refresh support multi pct tables#58140yiguolei merged 8 commits intoapache:branch-4.0from
yiguolei merged 8 commits intoapache:branch-4.0from
Conversation
### What problem does this PR solve? Currently, a materialized view can only have one PCT table. If the reference table has multiple partitioned tables and changes occur in non-PCT tables, even if only some partitions are modified, the materialized view must be fully refreshed, which is costly. Therefore, support for multiple PCT tables is needed, but with the following restrictions: - Only inner joins and unions (including UNION ALL) are supported. - In the case of unions, all base tables must be PCT tables; otherwise, the derivation fails. - The partition granularity across multiple PCT tables must align. For example: The following scenario is allowed: t1 has 2 partitions: [2020-01-01, 2020-01-02), [2020-01-02, 2020-01-03) t2 has 2 partitions: [2020-01-02, 2020-01-03), [2020-01-03, 2020-01-04) The following scenario is not allowed: t1 has 2 partitions: [2020-01-01, 2020-01-03), [2020-01-03, 2020-01-05) t2 has 2 partitions: [2020-01-01, 2020-01-02), [2020-01-02, 2020-01-03) However, if the materialized view uses monthly partition roll-up, the above scenario is allowed, because the materialized view only needs to generate one partition: [2020-01-01, 2020-02-01). --------- Co-authored-by: seawinde <daydayup005@yeah.net> Co-authored-by: seawinde <wusi@selectdb.com> # Conflicts: # fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVPartitionUtil.java # fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRewriteUtil.java # fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/MaterializedViewUtils.java # fe/fe-core/src/test/java/org/apache/doris/mtmv/MTMVRewriteUtilTest.java
…he#57759) - Restricting the use of external views to create MTMV - add case - fix display of mv_infos
…ew (apache#57958) ### What problem does this PR solve? Related PR: apache#56423 apache#56958 Problem Summary: 1. Fix partition trace fail when create partition mv with view and date_trunc 2. Fix err if use data_trunc('day', col) partition column when create partition materialized view the mv def sql would be success after this fix CREATE VIEW lineitem_daily_summary_view AS SELECT DATE_TRUNC('day', L_SHIPDATE) AS ship_date, L_RETURNFLAG, L_LINESTATUS, COUNT(*) AS order_count, SUM(L_QUANTITY) AS total_quantity, SUM(L_EXTENDEDPRICE) AS total_price, AVG(L_DISCOUNT) AS avg_discount FROM lineitem WHERE L_SHIPDATE IS NOT NULL GROUP BY ship_date, L_RETURNFLAG, L_LINESTATUS; mv def is as following SELECT ship_date, L_RETURNFLAG, SUM(order_count) AS total_orders, SUM(total_quantity) AS sum_quantity, SUM(total_price) AS sum_price, AVG(avg_discount) AS average_discount FROM lineitem_daily_summary_view GROUP BY ship_date, L_RETURNFLAG ORDER BY ship_date, L_RETURNFLAG, total_orders, sum_quantity, sum_price;
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
Contributor
Author
|
run buildall |
Contributor
FE UT Coverage ReportIncrement line coverage |
Contributor
Author
|
run p0 |
Contributor
Author
|
run buildall |
Contributor
Author
|
run buildall |
Contributor
FE UT Coverage ReportIncrement line coverage |
yiguolei
approved these changes
Nov 20, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pick: #56958 #57713 #57759 #57681 #57958