-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](mtmv) Fix union all rewrite wrongly when mv refresh which grace_period is big #50812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[fix](mtmv) Fix union all rewrite wrongly when mv refresh which grace_period is big #50812
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue with union all rewriting during materialized view refresh when the grace_period is large. Key changes include updating test outputs for union rewriting, improving logging to use sqlHash instead of queryId, caching valid MV partitions in the StatementContext, and adding a check on the materialized view property use_for_rewrite in the MV relation manager.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| regression-test/data/nereids_rules_p0/mv/union_rewrite_grace_big/unioin_rewrite_grace_big.out | Added expected output for union rewriting tests. |
| fe/fe-core/src/test/java/org/apache/doris/nereids/mv/OptimizeGetAvailableMvsTest.java | Added tests for both partition prune and non-partition prune scenarios. |
| fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/InitMaterializationContextHook.java | Updated log messages to use sqlHash instead of queryId. |
| fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/AbstractMaterializedViewRule.java | Changed MV partition retrieval to use the cached map from StatementContext. |
| fe/fe-core/src/main/java/org/apache/doris/nereids/StatementContext.java | Added a new map to cache MV available rewrite partitions. |
| fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelationManager.java | Added a check for the use_for_rewrite property and updated partition validation accordingly. |
Comments suppressed due to low confidence (1)
regression-test/data/nereids_rules_p0/mv/union_rewrite_grace_big/unioin_rewrite_grace_big.out:1
- The filename 'unioin_rewrite_grace_big.out' appears to be misspelled; consider renaming it to 'union_rewrite_grace_big.out' for clarity.
+-- This file is automatically generated. You should know what you did if you want to edit this
TPC-H: Total hot run time: 34182 ms |
TPC-DS: Total hot run time: 187050 ms |
ClickBench: Total hot run time: 29.02 s |
What problem does this PR solve?
there is mv def is
CREATE MATERIALIZED VIEW mv_1_name BUILD IMMEDIATE REFRESH AUTO ON MANUAL partition by(l_shipdate) DISTRIBUTED BY RANDOM BUCKETS 2 PROPERTIES ( 'replication_num' = '1', 'grace_period' = '31536000') AS select l_shipdate, o_orderdate, l_partkey, l_suppkey, sum(o_totalprice) as sum_total from lineitem left join orders on lineitem.l_orderkey = orders.o_orderkey and l_shipdate = o_orderdate group by l_shipdate, o_orderdate, l_partkey, l_suppkey;aflter mv_1_name refreshed, we insert into data to
lineitemif another mv_2_name which def is the same with the mv_1_name
when we refresh mv_2_name should contain the new inserted data, but now not, the pr fix this
Issue Number: close #xxx
Related PR: #38115
Problem Summary:
Release note
Fix union all rewrite wrongly when mv refresh which grace_period is big
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)