Commit 8875956
Handle canceled partitioned hash join dynamic filters lazily (#21666)
## Which issue does this PR close?
- Closes #21625
## Rationale for this change
Partitioned hash join dynamic filters assumed every build-side partition
would eventually report build data to the shared coordinator. That
assumption breaks when an upstream partitioned operator legally
short-circuits and drops a child hash-join partition before it is ever
polled far enough to report.
In the original reproducer, a parent `RightSemi` join completes early
for partitions whose own build side is empty. That causes child
partitioned hash-join streams to be dropped while still waiting to
build/report their dynamic-filter contribution. Sibling partitions then
wait forever for reports that will never arrive.
## What changes are included in this PR?
- teach the shared partitioned dynamic-filter coordinator to distinguish
terminal partition states:
- reported build data
- canceled before build data was known
- mark unreported partitioned hash-join streams as canceled on `Drop`
- treat canceled partitions as `true` in the synthesized partitioned
filter so they do not block completion or incorrectly filter probe rows
- preserve existing empty-partition behavior so known-empty partitions
still contribute `false`
- preserve the existing compact filter plan shapes when there are no
canceled partitions, including the single-branch collapse used in
hash-collision mode
- add a regression test for the cancellation pattern that previously
hung
## Are these changes tested?
- `cargo fmt --all`
- `cargo test -p datafusion-physical-plan
test_partitioned_dynamic_filter_reports_empty_canceled_partitions --
--nocapture`
- `cargo test -p datafusion --test core_integration
physical_optimizer::filter_pushdown::test_hashjoin_dynamic_filter_pushdown_partitioned
-- --nocapture`
- `cargo test -p datafusion --test core_integration
physical_optimizer::filter_pushdown::test_hashjoin_dynamic_filter_pushdown_partitioned
--features force_hash_collisions -- --nocapture`
- verified that
`test_partitioned_dynamic_filter_reports_empty_canceled_partitions`
times out on the pre-fix revision and passes on this branch
`cargo clippy --all-targets --all-features -- -D warnings` still fails
on an unrelated existing workspace lint in
`datafusion/expr/src/logical_plan/plan.rs:3773`
(`clippy::mutable_key_type`).
## Are there any user-facing changes?
No.
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 8a45d02 commit 8875956
3 files changed
Lines changed: 695 additions & 302 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1316 | 1316 | | |
1317 | 1317 | | |
1318 | 1318 | | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
1319 | 1346 | | |
1320 | 1347 | | |
1321 | 1348 | | |
| |||
1343 | 1370 | | |
1344 | 1371 | | |
1345 | 1372 | | |
1346 | | - | |
1347 | 1373 | | |
1348 | 1374 | | |
1349 | 1375 | | |
| |||
1368 | 1394 | | |
1369 | 1395 | | |
1370 | 1396 | | |
1371 | | - | |
1372 | | - | |
1373 | | - | |
1374 | | - | |
1375 | | - | |
1376 | | - | |
1377 | | - | |
1378 | | - | |
1379 | | - | |
1380 | | - | |
1381 | | - | |
1382 | | - | |
1383 | | - | |
1384 | | - | |
1385 | | - | |
1386 | | - | |
1387 | | - | |
1388 | | - | |
1389 | | - | |
1390 | | - | |
1391 | | - | |
1392 | | - | |
1393 | | - | |
1394 | | - | |
1395 | | - | |
1396 | | - | |
1397 | | - | |
1398 | 1397 | | |
1399 | 1398 | | |
1400 | 1399 | | |
| |||
2347 | 2346 | | |
2348 | 2347 | | |
2349 | 2348 | | |
| 2349 | + | |
| 2350 | + | |
| 2351 | + | |
| 2352 | + | |
| 2353 | + | |
| 2354 | + | |
| 2355 | + | |
| 2356 | + | |
| 2357 | + | |
| 2358 | + | |
| 2359 | + | |
| 2360 | + | |
| 2361 | + | |
| 2362 | + | |
| 2363 | + | |
| 2364 | + | |
2350 | 2365 | | |
2351 | 2366 | | |
2352 | 2367 | | |
| |||
2356 | 2371 | | |
2357 | 2372 | | |
2358 | 2373 | | |
2359 | | - | |
| 2374 | + | |
2360 | 2375 | | |
2361 | 2376 | | |
2362 | 2377 | | |
| |||
5628 | 5643 | | |
5629 | 5644 | | |
5630 | 5645 | | |
| 5646 | + | |
| 5647 | + | |
| 5648 | + | |
| 5649 | + | |
| 5650 | + | |
| 5651 | + | |
| 5652 | + | |
| 5653 | + | |
| 5654 | + | |
| 5655 | + | |
| 5656 | + | |
| 5657 | + | |
| 5658 | + | |
| 5659 | + | |
| 5660 | + | |
| 5661 | + | |
| 5662 | + | |
| 5663 | + | |
| 5664 | + | |
| 5665 | + | |
| 5666 | + | |
| 5667 | + | |
| 5668 | + | |
| 5669 | + | |
| 5670 | + | |
| 5671 | + | |
| 5672 | + | |
| 5673 | + | |
| 5674 | + | |
| 5675 | + | |
| 5676 | + | |
| 5677 | + | |
| 5678 | + | |
| 5679 | + | |
| 5680 | + | |
| 5681 | + | |
| 5682 | + | |
| 5683 | + | |
| 5684 | + | |
| 5685 | + | |
| 5686 | + | |
| 5687 | + | |
| 5688 | + | |
| 5689 | + | |
| 5690 | + | |
| 5691 | + | |
| 5692 | + | |
| 5693 | + | |
| 5694 | + | |
| 5695 | + | |
| 5696 | + | |
| 5697 | + | |
| 5698 | + | |
| 5699 | + | |
| 5700 | + | |
| 5701 | + | |
| 5702 | + | |
| 5703 | + | |
| 5704 | + | |
| 5705 | + | |
| 5706 | + | |
| 5707 | + | |
| 5708 | + | |
| 5709 | + | |
| 5710 | + | |
| 5711 | + | |
| 5712 | + | |
| 5713 | + | |
| 5714 | + | |
| 5715 | + | |
| 5716 | + | |
| 5717 | + | |
| 5718 | + | |
| 5719 | + | |
| 5720 | + | |
| 5721 | + | |
| 5722 | + | |
| 5723 | + | |
| 5724 | + | |
| 5725 | + | |
| 5726 | + | |
| 5727 | + | |
| 5728 | + | |
| 5729 | + | |
| 5730 | + | |
| 5731 | + | |
| 5732 | + | |
| 5733 | + | |
| 5734 | + | |
| 5735 | + | |
| 5736 | + | |
| 5737 | + | |
| 5738 | + | |
| 5739 | + | |
| 5740 | + | |
| 5741 | + | |
| 5742 | + | |
| 5743 | + | |
| 5744 | + | |
| 5745 | + | |
| 5746 | + | |
| 5747 | + | |
| 5748 | + | |
| 5749 | + | |
| 5750 | + | |
| 5751 | + | |
| 5752 | + | |
| 5753 | + | |
| 5754 | + | |
| 5755 | + | |
| 5756 | + | |
| 5757 | + | |
| 5758 | + | |
| 5759 | + | |
| 5760 | + | |
| 5761 | + | |
| 5762 | + | |
| 5763 | + | |
| 5764 | + | |
| 5765 | + | |
| 5766 | + | |
| 5767 | + | |
| 5768 | + | |
| 5769 | + | |
| 5770 | + | |
| 5771 | + | |
| 5772 | + | |
| 5773 | + | |
| 5774 | + | |
| 5775 | + | |
| 5776 | + | |
| 5777 | + | |
| 5778 | + | |
| 5779 | + | |
| 5780 | + | |
| 5781 | + | |
| 5782 | + | |
| 5783 | + | |
| 5784 | + | |
| 5785 | + | |
| 5786 | + | |
| 5787 | + | |
| 5788 | + | |
| 5789 | + | |
| 5790 | + | |
| 5791 | + | |
| 5792 | + | |
| 5793 | + | |
| 5794 | + | |
| 5795 | + | |
| 5796 | + | |
| 5797 | + | |
5631 | 5798 | | |
5632 | 5799 | | |
5633 | 5800 | | |
| |||
0 commit comments