-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](mtmv) Fix compensate union wrongly when direct query is empty relation #51700
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 compensate union wrongly when direct query is empty relation #51700
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
| return context.getRewritePlan(); | ||
| }, queryPlanWithUnionFilter, queryPlan), true); | ||
| }, queryPlanWithUnionFilter, queryPlan); | ||
| // need to collect table partition again |
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.
write why need re-collect here in comment
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
| // this is needed before init hook | ||
| collectTableUsedPartitions(showPlanProcess); | ||
| // this is needed before init hook, because | ||
| MaterializedViewUtils.collectTableUsedPartitions(cascadesContext.getRewritePlan(), cascadesContext); |
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 not do it in hook?
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.
move it in hook
| }, queryPlanWithUnionFilter, queryPlan), true); | ||
| }, queryPlanWithUnionFilter, queryPlan); | ||
| // need to collect table partition again | ||
| MaterializedViewUtils.collectTableUsedPartitions(filterAddedPlan, parentCascadesContext); |
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.
if u need collect partition info multi times, u should sum the time used by it in summary profile
| }, queryPlanWithUnionFilter, queryPlan), true); | ||
| }, queryPlanWithUnionFilter, queryPlan); | ||
| // need to collect table partition again | ||
| MaterializedViewUtils.collectTableUsedPartitions(filterAddedPlan, parentCascadesContext); |
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.
only collect for sub plan is enough?
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.
should collect table partition for all rewritten plan by mv, have fixed it
TPC-H: Total hot run time: 35905 ms |
FE UT Coverage ReportIncrement line coverage |
|
run external 10 |
TPC-H: Total hot run time: 36238 ms |
|
run external 5 |
4a2a8c6 to
b95c035
Compare
|
run buildall |
TPC-H: Total hot run time: 34052 ms |
|
run buildall |
TPC-H: Total hot run time: 33763 ms |
|
run buildall |
FE UT Coverage ReportIncrement line coverage |
|
run external 10 |
TPC-H: Total hot run time: 34190 ms |
TPC-DS: Total hot run time: 184911 ms |
ClickBench: Total hot run time: 28.89 s |
|
run buildall |
c9108e7 to
fe19d56
Compare
|
run buildall |
TPC-H: Total hot run time: 33682 ms |
…elation (apache#51700) if query is as following which contains external table, if some partition in external table is empty, when mv partiton is invalid, this would cause compensate many union all empty relation ```sql SELECT * FROM ${catalogName}.`test_paimon_spark`.test_tb_mix_format a left join ${tableName} b on a.id=b.user_id; ```
…elation (apache#51700) if query is as following which contains external table, if some partition in external table is empty, when mv partiton is invalid, this would cause compensate many union all empty relation ```sql SELECT * FROM ${catalogName}.`test_paimon_spark`.test_tb_mix_format a left join ${tableName} b on a.id=b.user_id; ```
…elation (apache#51700) if query is as following which contains external table, if some partition in external table is empty, when mv partiton is invalid, this would cause compensate many union all empty relation ```sql SELECT * FROM ${catalogName}.`test_paimon_spark`.test_tb_mix_format a left join ${tableName} b on a.id=b.user_id; ```
…y is empty relation apache#51700 (apache#51898) Cherry-picked apache#51700
What problem does this PR solve?
if query is as following which contains external table, if some partition in external table is empty, when mv partiton is invalid, this would cause compensate many union all empty relation
Issue Number: close #xxx
Related PR: #49514
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)