-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](mtmv) Fix mv rewrite failed when mv is rewritten by LimitAggToTopNAgg but query is not #58974
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 mv rewrite failed when mv is rewritten by LimitAggToTopNAgg but query is not #58974
Conversation
…opNAgg but query is not
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
TPC-H: Total hot run time: 35773 ms |
TPC-DS: Total hot run time: 180941 ms |
ClickBench: Total hot run time: 27.47 s |
FE Regression Coverage ReportIncrement line coverage |
1 similar comment
FE Regression Coverage ReportIncrement line coverage |
|
run buildall |
TPC-H: Total hot run time: 35125 ms |
TPC-DS: Total hot run time: 179247 ms |
ClickBench: Total hot run time: 27.48 s |
FE UT Coverage ReportIncrement line coverage |
|
run buildall |
TPC-H: Total hot run time: 36039 ms |
TPC-DS: Total hot run time: 177746 ms |
ClickBench: Total hot run time: 27.59 s |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
FE Regression Coverage ReportIncrement line coverage |
1 similar comment
FE Regression Coverage ReportIncrement line coverage |
…opNAgg but query is not (#58974) Fix mv rewrite failed when mv is rewritten by LimitAggToTopNAgg but query is not such as query and mv def sql is as fllowing: ```sql SELECT c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, sum(l_quantity) FROM customer, orders, lineitem WHERE o_orderkey IN ( SELECT l_orderkey FROM lineitem GROUP BY l_orderkey HAVING sum(l_quantity) > 300 ) AND c_custkey = o_custkey AND o_orderkey = l_orderkey GROUP BY c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice ORDER BY o_totalprice DESC, o_orderdate LIMIT 100 ``` if query plan is rewrtten by rule `LimitAggToTopNAgg`, plan would be like as following, tonN contains all goup by key ```sql LogicalResultSink[812] ( outputExprs=[c_name#1, c_custkey#0, o_orderkey#8, o_orderdate#12, o_totalprice#11, __sum_5#50] ) **| +--LogicalTopN ( limit=100, offset=0, orderKeys=[o_totalprice#11 desc, o_orderdate#12 asc null first, c_name#1 asc, c_custkey#0 asc, o_orderkey#8 asc] )** ``` if mv plan is not rewrtten by rule `LimitAggToTopNAgg`, plan would be like as following, tonN not contain all goup by key ```sql LogicalResultSink[801] ( outputExprs=[c_name#1, c_custkey#0, o_orderkey#8, o_orderdate#12, o_totalprice#11, __sum_5#50] ) **+--LogicalTopN ( limit=100, offset=0, orderKeys=[o_totalprice#11 desc, o_orderdate#12 asc null first] )** ``` this would cause `doris/regression-test/suites/nereids_rules_p0/mv/tpch/mv_tpch_test.groovy` mv18 rewrite fail, the pr fix this
What problem does this PR solve?
Fix mv rewrite failed when mv is rewritten by LimitAggToTopNAgg but query is not
such as query and mv def sql is as fllowing:
if query plan is rewrtten by rule
LimitAggToTopNAgg, plan would be like as following, tonN contains all goup by keyif mv plan is not rewrtten by rule
LimitAggToTopNAgg, plan would be like as following, tonN not contain all goup by keythis would cause
doris/regression-test/suites/nereids_rules_p0/mv/tpch/mv_tpch_test.groovymv18 rewrite fail, the pr fix thisIssue Number: close #xxx
Related PR: #xxx
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)