-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](mtmv) Fix nested mv rewritten fail when bottom mv is partitioned #57558
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 nested mv rewritten fail when bottom mv is partitioned #57558
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
ClickBench: Total hot run time: 29.03 s |
| Map<List<String>, Set<String>> queryUsedRelatedTablePartitionsMap = new HashMap<>(); | ||
| tableLoop: | ||
| for (Map.Entry<List<String>, TableIf> queryUsedTableEntry : statementContext.getTables().entrySet()) { | ||
| for (List<String> queryUsedTable : tableUsedPartitionNameMap.keySet()) { |
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.
why change to use this map
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.
beacuse some table would not in tables in statement context, such as bottom mv which is not query directly in query, so not need to use tables in statement context,
| } | ||
| usedPartitionSet.addAll(partitionPair.value()); | ||
| tableUsedPartitionNameMap.get(queryUsedTable); | ||
| if (ALL_PARTITIONS_LIST.equals(tableUsedPartitions)) { |
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.
Add some comments to explain what ALL-PARTITION-LIST is and what ALL-PARTITION-LIST. equals (tableUsedPieces) means
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.
have added comment
| } | ||
| for (Pair<RelationId, Set<String>> tableUsedPartitionPair : tableUsedPartitions) { | ||
| if (!customRelationIdSet.isEmpty()) { | ||
| if (ALL_PARTITIONS.equals(tableUsedPartitionPair)) { |
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.
ditto
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.
have added comment
| mv_rewrite_any_success(sql_5, [mv_3, mv_4, mv_5]) | ||
| compare_res(sql_5 + " order by 1,2,3,4,5,6,7,8,9,10,11,12,13") | ||
|
|
||
| sql """ |
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.
Add some case validation to supplement union situations, such as inserting a row of data into a partition of the base table
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.
union situations not support query rewrite by materialized view currently, so not need to add
FE Regression Coverage ReportIncrement line coverage |
|
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.
what's this?
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.
Complete the comments
TPC-DS: Total hot run time: 190359 ms |
ClickBench: Total hot run time: 27.83 s |
|
run buildall |
ClickBench: Total hot run time: 29.34 s |
FE Regression Coverage ReportIncrement line coverage |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
apache#57558) Related PR: apache#49514 apache#56958 Problem Summary: In the scenario of nested materialized view rewriting, if the underlying materialized view is a partitioned materialized view, the rewriting of the upper-level materialized view would fail. This PR fixes the issue.
apache#57558) Related PR: apache#49514 apache#56958 Problem Summary: In the scenario of nested materialized view rewriting, if the underlying materialized view is a partitioned materialized view, the rewriting of the upper-level materialized view would fail. This PR fixes the issue.
apache#57558) Related PR: apache#49514 apache#56958 Problem Summary: In the scenario of nested materialized view rewriting, if the underlying materialized view is a partitioned materialized view, the rewriting of the upper-level materialized view would fail. This PR fixes the issue.
… partitioned (#57558) (#58277) pr: #57558 commitId: 5e43141 ### What problem does this PR solve? Issue Number: close #xxx Related PR: #xxx Problem Summary: ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
…te fail because of invalid slot (#58643) ### What problem does this PR solve? Related PR: #57558 #58413 Problem Summary: This fix addresses the following three issues: 1. When invoking the method org.apache.doris.nereids.trees.plans.logical.LogicalHudiScan#withRelationId, the output needs to be recalculated to meet expectations. 2. After compensating with a union all due to partial partition invalidation of a materialized view, during the next round of transparent rewriting, the rewriting for the child of the union allshould use the query partitioncorresponding to the specific relation id to prevent infinite loops. 3. Currently, in the `test_hudi_rewrite_mtmv` test, if the plan rewritten by the materialized view transparent rewriting is not selected by the CBO, it is difficult to troubleshoot because explain memo planis not used. Therefore, the corresponding test method is modified.
…te fail because of invalid slot (apache#58643) Related PR: apache#57558 apache#58413 Problem Summary: This fix addresses the following three issues: 1. When invoking the method org.apache.doris.nereids.trees.plans.logical.LogicalHudiScan#withRelationId, the output needs to be recalculated to meet expectations. 2. After compensating with a union all due to partial partition invalidation of a materialized view, during the next round of transparent rewriting, the rewriting for the child of the union allshould use the query partitioncorresponding to the specific relation id to prevent infinite loops. 3. Currently, in the `test_hudi_rewrite_mtmv` test, if the plan rewritten by the materialized view transparent rewriting is not selected by the CBO, it is difficult to troubleshoot because explain memo planis not used. Therefore, the corresponding test method is modified.
…te fail because of invalid slot (apache#58643) Related PR: apache#57558 apache#58413 Problem Summary: This fix addresses the following three issues: 1. When invoking the method org.apache.doris.nereids.trees.plans.logical.LogicalHudiScan#withRelationId, the output needs to be recalculated to meet expectations. 2. After compensating with a union all due to partial partition invalidation of a materialized view, during the next round of transparent rewriting, the rewriting for the child of the union allshould use the query partitioncorresponding to the specific relation id to prevent infinite loops. 3. Currently, in the `test_hudi_rewrite_mtmv` test, if the plan rewritten by the materialized view transparent rewriting is not selected by the CBO, it is difficult to troubleshoot because explain memo planis not used. Therefore, the corresponding test method is modified.
…te fail because of invalid slot (apache#58643) ### What problem does this PR solve? Related PR: apache#57558 apache#58413 Problem Summary: This fix addresses the following three issues: 1. When invoking the method org.apache.doris.nereids.trees.plans.logical.LogicalHudiScan#withRelationId, the output needs to be recalculated to meet expectations. 2. After compensating with a union all due to partial partition invalidation of a materialized view, during the next round of transparent rewriting, the rewriting for the child of the union allshould use the query partitioncorresponding to the specific relation id to prevent infinite loops. 3. Currently, in the `test_hudi_rewrite_mtmv` test, if the plan rewritten by the materialized view transparent rewriting is not selected by the CBO, it is difficult to troubleshoot because explain memo planis not used. Therefore, the corresponding test method is modified.
What problem does this PR solve?
In the scenario of nested materialized view rewriting, if the underlying materialized view is a partitioned materialized view, the rewriting of the upper-level materialized view would fail. This PR fixes the issue.
Issue Number: close #xxx
Related PR: #49514 #56958
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)