Skip to content

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Nov 3, 2025

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);
@github-actions github-actions bot requested a review from morrySnow as a code owner November 3, 2025 03:46
@hello-stephen
Copy link
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?

@dataroaring dataroaring closed this Nov 3, 2025
@dataroaring dataroaring reopened this Nov 3, 2025
@hello-stephen
Copy link
Contributor

run buildall

@morrySnow
Copy link
Contributor

compile failed

@morrySnow morrySnow closed this Nov 4, 2025
Sign up for free to 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.

5 participants