Repository navigation
Commit 9adfd2d
authored
[fix](mv) Compensate complete invalid roll-up partition buckets (apache#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)1 parent 62b26c2 commit 9adfd2d
2 files changed
Lines changed: 83 additions & 2 deletions
File tree
- fe/fe-core/src
- main/java/org/apache/doris/nereids/rules/exploration/mv
- test/java/org/apache/doris/nereids/rules/exploration/mv
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
204 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
205 | 208 | | |
206 | 209 | | |
207 | 210 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
487 | 487 | | |
488 | 488 | | |
489 | 489 | | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
490 | 568 | | |
491 | 569 | | |
492 | 570 | | |
| |||
0 commit comments