Skip to content

branch-3.1: [fix](mtmv) Fix mv rewrite fail when mv contains group sets and filter above scan #57343 - #57616

Closed
github-actions[bot] wants to merge 1 commit into
branch-3.1from
auto-pick-57343-branch-3.1
Closed

branch-3.1: [fix](mtmv) Fix mv rewrite fail when mv contains group sets and filter above scan #57343#57616
github-actions[bot] wants to merge 1 commit into
branch-3.1from
auto-pick-57343-branch-3.1

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Cherry-picked from #57343

…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);
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@hello-stephen

Copy link
Copy Markdown
Contributor

run buildall

@morrySnow

Copy link
Copy Markdown
Contributor

compile failed

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@hello-stephen@morrySnow@dataroaring@seawinde