-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](mtmv) Fix mv rewrite fail when mv contains group sets and filter above scan #57343
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
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
ClickBench: Total hot run time: 28.26 s |
|
run buildall |
TPC-DS: Total hot run time: 189302 ms |
ClickBench: Total hot run time: 27.68 s |
FE UT Coverage ReportIncrement line coverage |
zddr
left a 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.
LGTM
|
PR approved by anyone and no changes requested. |
| private static class PredicateCollector extends DefaultPlanVisitor<Void, Set<Expression>> { | ||
| @Override | ||
| public Void visit(Plan plan, Set<Expression> predicates) { | ||
| // Just collect the filter in top plan, if meet other node except project and filter, return |
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.
nit: update this comment
|
PR approved by at least one committer and no changes requested. |
…r above scan (#57343) ### What problem does this PR solve? Related PR: #36056 Problem Summary: if mv is defined as following CREATE MATERIALIZED VIEW mv_11 BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL DISTRIBUTED BY RANDOM BUCKETS 2 PROPERTIES ('replication_num' = '1') AS select o_orderstatus, o_orderdate, o_orderpriority, sum(o_totalprice) as sum_total, max(o_totalprice) as max_total, min(o_totalprice) as min_total, count(*) as count_all, bitmap_union(to_bitmap(case when o_shippriority > 1 and o_orderkey IN (1, 3) then o_custkey else null end)) as bitmap_union_basic from orders where o_custkey > 1 group by o_orderstatus, o_orderdate, o_orderpriority; there is filter `where o_custkey > 1` in mv, if query is as following, should be rewritten successfully but fail, because the filter `o_custkey > 1` is lost compare and could not compensate the filter, the pr fixed this. select o_orderstatus, o_orderpriority, grouping_id(o_orderstatus, o_orderpriority), grouping_id(o_orderstatus), grouping(o_orderstatus), sum(o_totalprice), max(o_totalprice), min(o_totalprice), count(*), count(distinct case when o_shippriority > 1 and o_orderkey IN (1, 3) then o_custkey else null end) from orders where o_custkey > 1 group by ROLLUP (o_orderstatus, o_orderpriority);
…r above scan (#57343) ### What problem does this PR solve? Related PR: #36056 Problem Summary: if mv is defined as following CREATE MATERIALIZED VIEW mv_11 BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL DISTRIBUTED BY RANDOM BUCKETS 2 PROPERTIES ('replication_num' = '1') AS select o_orderstatus, o_orderdate, o_orderpriority, sum(o_totalprice) as sum_total, max(o_totalprice) as max_total, min(o_totalprice) as min_total, count(*) as count_all, bitmap_union(to_bitmap(case when o_shippriority > 1 and o_orderkey IN (1, 3) then o_custkey else null end)) as bitmap_union_basic from orders where o_custkey > 1 group by o_orderstatus, o_orderdate, o_orderpriority; there is filter `where o_custkey > 1` in mv, if query is as following, should be rewritten successfully but fail, because the filter `o_custkey > 1` is lost compare and could not compensate the filter, the pr fixed this. select o_orderstatus, o_orderpriority, grouping_id(o_orderstatus, o_orderpriority), grouping_id(o_orderstatus), grouping(o_orderstatus), sum(o_totalprice), max(o_totalprice), min(o_totalprice), count(*), count(distinct case when o_shippriority > 1 and o_orderkey IN (1, 3) then o_custkey else null end) from orders where o_custkey > 1 group by ROLLUP (o_orderstatus, o_orderpriority);
…r above scan (apache#57343) ### What problem does this PR solve? Related PR: apache#36056 Problem Summary: if mv is defined as following CREATE MATERIALIZED VIEW mv_11 BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL DISTRIBUTED BY RANDOM BUCKETS 2 PROPERTIES ('replication_num' = '1') AS select o_orderstatus, o_orderdate, o_orderpriority, sum(o_totalprice) as sum_total, max(o_totalprice) as max_total, min(o_totalprice) as min_total, count(*) as count_all, bitmap_union(to_bitmap(case when o_shippriority > 1 and o_orderkey IN (1, 3) then o_custkey else null end)) as bitmap_union_basic from orders where o_custkey > 1 group by o_orderstatus, o_orderdate, o_orderpriority; there is filter `where o_custkey > 1` in mv, if query is as following, should be rewritten successfully but fail, because the filter `o_custkey > 1` is lost compare and could not compensate the filter, the pr fixed this. select o_orderstatus, o_orderpriority, grouping_id(o_orderstatus, o_orderpriority), grouping_id(o_orderstatus), grouping(o_orderstatus), sum(o_totalprice), max(o_totalprice), min(o_totalprice), count(*), count(distinct case when o_shippriority > 1 and o_orderkey IN (1, 3) then o_custkey else null end) from orders where o_custkey > 1 group by ROLLUP (o_orderstatus, o_orderpriority);
What problem does this PR solve?
if mv is defined as following
CREATE MATERIALIZED VIEW mv_11 BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL DISTRIBUTED BY RANDOM BUCKETS 2 PROPERTIES ('replication_num' = '1') AS select o_orderstatus, o_orderdate, o_orderpriority, sum(o_totalprice) as sum_total, max(o_totalprice) as max_total, min(o_totalprice) as min_total, count(*) as count_all, bitmap_union(to_bitmap(case when o_shippriority > 1 and o_orderkey IN (1, 3) then o_custkey else null end)) as bitmap_union_basic from orders where o_custkey > 1 group by o_orderstatus, o_orderdate, o_orderpriority;there is filter
where o_custkey > 1in mv, if query is as following, should be rewritten successfully but fail, because the filtero_custkey > 1is lost compare and could not compensate the filter, the pr fixed this.Issue Number: close #xxx
Related PR: #36056
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)