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

   ## Problem
   
   During partition-union rewrite, a roll-up materialized-view partition can 
cover multiple base-table partitions. When that MV partition is invalid and 
removed as a whole, compensating only the base partitions that overlap the raw 
query partition set can leave the replacement scope smaller than the removed MV 
bucket and produce incorrect aggregate results.
   
   ## Root cause
   
   The compensation calculation used the intersection between an invalid MV 
partition's complete base-partition mapping and the raw query partitions as 
both the relevance test and the compensation set. This lost the atomic 
relationship between one MV partition and every base partition mapped to it.
   
   ## Reproduction
   
   Use one valid MV partition mapped to `p3`, one invalid roll-up partition 
mapped to `{p1, p2}`, and another invalid partition mapped to `{p4, p5}`. For a 
raw query partition set `{p1, p3}`, the old calculation compensated only `p1`, 
even though the complete intersecting roll-up bucket was removed. The disjoint 
`{p4, p5}` bucket must still remain outside compensation.
   
   ## Fix
   
   Use the intersection only to decide whether an invalid MV partition is 
relevant to the query. Once relevant, add its complete base-partition mapping 
to compensation. Invalid MV partitions with no intersection remain excluded, 
preserving the existing query-range guard. The existing multi-PCT-table merge 
behavior is unchanged.
   
   ## Tests
   
   - `./run-fe-ut.sh --run 
org.apache.doris.nereids.rules.exploration.mv.PartitionCompensatorTest` (13 
tests passed)
   - `DISABLE_BUILD_UI=ON ./build.sh --fe` (passed; the host's Node.js 16 
cannot build the current UI, so the supported no-UI FE build path was used)
   - `./run-regression-test.sh --run -s mtmv_range_date_part_up_rewrite ...` (1 
suite passed)
   


-- 
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