Commit 5340653
authored
fix: preserve range partitioning through joins (#23584)
## Which issue does this PR close?
- Closes #23450.
## Rationale for this change
#23184 allowed compatible range-partitioned inputs to satisfy
partitioned inner joins without hash repartitioning. However, join
output still downgraded `Partitioning::Range` to `UnknownPartitioning`,
so downstream joins and aggregates could not reuse the preserved range
layout and inserted avoidable hash repartitions.
## What changes are included in this PR?
- Preserve `Partitioning::Range` in `adjust_right_output_partitioning`.
- Shift right-side range-ordering column indexes into the joined schema
while retaining split points and sort options.
- Add unit coverage for compound range keys and non-default sort
options.
- Update SQL logic test plans for nested range joins and a range join
feeding an aggregate.
## Are these changes tested?
Yes.
- `./dev/rust_lint.sh`
- `cargo clippy --all-targets --all-features -- -D warnings`
- `cargo test -p datafusion-physical-plan
test_adjust_right_output_partitioning_preserves_range`
- `cargo test --profile=ci --test sqllogictests --
range_partitioning.slt`
- `ulimit -n 10240 && RUST_BACKTRACE=1 cargo test --profile ci --exclude
datafusion-examples --exclude datafusion-benchmarks --exclude
datafusion-cli --workspace --lib --tests --bins --features
avro,json,backtrace,extended_tests,recursive_protection,parquet_encryption`
## Are there any user-facing changes?
Yes. Physical plans can preserve proven range partitioning through
joins, allowing compatible downstream joins and aggregates to avoid
unnecessary hash repartitioning. There are no public API changes.1 parent e123e6f commit 5340653
2 files changed
Lines changed: 76 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
71 | | - | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
146 | 147 | | |
147 | 148 | | |
148 | 149 | | |
149 | | - | |
150 | | - | |
151 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
152 | 163 | | |
153 | 164 | | |
154 | 165 | | |
| |||
2468 | 2479 | | |
2469 | 2480 | | |
2470 | 2481 | | |
2471 | | - | |
| 2482 | + | |
2472 | 2483 | | |
2473 | 2484 | | |
2474 | 2485 | | |
| |||
4131 | 4142 | | |
4132 | 4143 | | |
4133 | 4144 | | |
| 4145 | + | |
| 4146 | + | |
| 4147 | + | |
| 4148 | + | |
| 4149 | + | |
| 4150 | + | |
| 4151 | + | |
| 4152 | + | |
| 4153 | + | |
| 4154 | + | |
| 4155 | + | |
| 4156 | + | |
| 4157 | + | |
| 4158 | + | |
| 4159 | + | |
| 4160 | + | |
| 4161 | + | |
| 4162 | + | |
| 4163 | + | |
| 4164 | + | |
| 4165 | + | |
| 4166 | + | |
| 4167 | + | |
| 4168 | + | |
| 4169 | + | |
| 4170 | + | |
| 4171 | + | |
| 4172 | + | |
| 4173 | + | |
| 4174 | + | |
| 4175 | + | |
| 4176 | + | |
| 4177 | + | |
| 4178 | + | |
| 4179 | + | |
| 4180 | + | |
| 4181 | + | |
| 4182 | + | |
| 4183 | + | |
| 4184 | + | |
| 4185 | + | |
| 4186 | + | |
| 4187 | + | |
| 4188 | + | |
| 4189 | + | |
| 4190 | + | |
| 4191 | + | |
4134 | 4192 | | |
4135 | 4193 | | |
4136 | 4194 | | |
| |||
Lines changed: 12 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
506 | 506 | | |
507 | 507 | | |
508 | 508 | | |
509 | | - | |
510 | | - | |
511 | | - | |
| 509 | + | |
| 510 | + | |
512 | 511 | | |
513 | 512 | | |
514 | 513 | | |
| |||
519 | 518 | | |
520 | 519 | | |
521 | 520 | | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
528 | 525 | | |
529 | 526 | | |
530 | 527 | | |
| |||
599 | 596 | | |
600 | 597 | | |
601 | 598 | | |
602 | | - | |
603 | | - | |
604 | | - | |
| 599 | + | |
| 600 | + | |
605 | 601 | | |
606 | 602 | | |
607 | 603 | | |
| |||
611 | 607 | | |
612 | 608 | | |
613 | 609 | | |
614 | | - | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
620 | 614 | | |
621 | 615 | | |
622 | 616 | | |
| |||
0 commit comments