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

   ## Proposed changes
   This is brought by https://github.com/apache/doris/pull/35562 
   
   When mv is partition rolled up mv, which is rolled up by date_trunc. If base 
table add new partition.
   if query rewrite successfully by the partition mv, the data will lost the 
new partition data.  This pr fix this problem.
   For example as following:
   mv def is:
   
   >        CREATE MATERIALIZED VIEW roll_up_mv
   >        BUILD IMMEDIATE REFRESH AUTO ON MANUAL
   >        partition by (date_trunc(`col1`, 'month'))
   >        DISTRIBUTED BY RANDOM BUCKETS 2
   >        PROPERTIES ('replication_num' = '1')
   >        AS
   >   select date_trunc(`l_shipdate`, 'day') as col1, l_shipdate, o_orderdate, 
l_partkey,
   >    l_suppkey, sum(o_totalprice) as sum_total
   >    from lineitem
   >    left join orders on lineitem.l_orderkey = orders.o_orderkey and 
l_shipdate = o_orderdate
   >    group by
   >    col1,
   >    l_shipdate,
   >    o_orderdate,
   >    l_partkey,
   >    l_suppkey;
   
   if run the insert comand
   ```
   insert into lineitem values
       (1, 2, 3, 4, 5.5, 6.5, 7.5, 8.5, 'o', 'k', '2023-11-21', '2023-11-21', 
'2023-11-21', 'a', 'b', 'yyyyyyyyy');
   ```
   
   then run query as following, result will not return the `2023-11-21 
partition` data
   >     select date_trunc(`l_shipdate`, 'day') as col1, l_shipdate, 
o_orderdate, l_partkey,
   >    l_suppkey, sum(o_totalprice) as sum_total
   >    from lineitem
   >    left join orders on lineitem.l_orderkey = orders.o_orderkey and 
l_shipdate = o_orderdate
   >    group by
   >    col1,
   >    l_shipdate,
   >    o_orderdate,
   >    l_partkey,
   >    l_suppkey;
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to