seawinde opened a new pull request, #48222:
URL: https://github.com/apache/doris/pull/48222

   ### What problem does this PR solve?
   Fix nest mtmv rewrite fail when bottom mtmv cache is invalid
   
   such as bottom mv is mv_1 and mv_2 as following:
   ```sql
       **mv_1**
           select l_orderkey, l_partkey, l_suppkey, o_orderkey, o_custkey, 
cast(sum(IFNULL(o_orderkey, 0) * IFNULL(o_custkey, 0)) as decimal(28, 8)) as 
agg1,
           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)) cnt_1, 
           bitmap_union(to_bitmap(case when o_shippriority > 2 and o_orderkey 
IN (2) then o_custkey else null end)) as cnt_2 
           from lineitem_1
           inner join orders_1
           on lineitem_1.l_orderkey = orders_1.o_orderkey
           where lineitem_1.l_shipdate >= "2023-10-17"
           group by l_orderkey, l_partkey, l_suppkey, o_orderkey, o_custkey
    
       **mv_2**
           select l_orderkey, l_partkey, l_suppkey, o_orderkey, o_custkey, 
ps_partkey, ps_suppkey,
           t.agg1 as agg1, 
           t.sum_total as agg3,
           t.max_total as agg4,
           t.min_total as agg5,
           t.count_all as agg6,
           cast(sum(IFNULL(ps_suppkey, 0) * IFNULL(ps_partkey, 0)) as 
decimal(28, 8)) as agg2
           from ${mv_1} as t
           inner join partsupp_1
           on t.l_partkey = partsupp_1.ps_partkey and t.l_suppkey = 
partsupp_1.ps_suppkey
           where partsupp_1.ps_suppkey > 1
           group by l_orderkey, l_partkey, l_suppkey, o_orderkey, o_custkey, 
ps_partkey, ps_suppkey, agg1, agg3, agg4, agg5, agg6
   
   ```
   
   query as following would fail if mtmvCache invalid in mv_1 and mv_2, the pr 
fix this
   
   Issue Number: close #xxx
   
   Related PR: #xxx
   
   Problem Summary:
   
   ### Release note
   
   Fix nest mtmv rewrite fail when bottom mtmv cache is invalid
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [ ] Regression test
       - [ ] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [x] This is a refactor/code format and no logic has been changed.
           - [x] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason <!-- Add your reason?  -->
   
   - Behavior changed:
       - [ ] No.
       - [ ] Yes. <!-- Explain the behavior change -->
   
   - Does this need documentation?
       - [ ] No.
       - [ ] Yes. <!-- Add document PR link here. eg: 
https://github.com/apache/doris-website/pull/1214 -->
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label <!-- Add branch pick label that this PR should 
merge into -->
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to