Commit 1a87e76
proto: round-trip SortExec's TopK dynamic filter
Add optional PhysicalExprNode dynamic_filter field to SortExecNode.
Emit from to_proto via SortExec::dynamic_filter(); on deserialize parse
it and install via SortExec::with_dynamic_filter after the usual
with_fetch / with_preserve_partitioning chain. The with_fetch step may
auto-create a TopK filter when fetch is set; with_dynamic_filter then
replaces it with the one from the sender so the id matches the
pushed-down scan's copy (shared via the id cache).
Add an end-to-end SQL test in
core/tests/physical_optimizer/filter_pushdown.rs that writes two
single-row parquet files (`a.parquet` with key=1, `b.parquet` with
key=2), runs `ORDER BY n_nationkey ASC LIMIT 1` with
`target_partitions=1`, round-trips via DeduplicatingProtoConverter,
executes, and asserts the scan emitted exactly 1 row — b.parquet was
pruned by row-group statistics after TopK saw a's row and tightened
the shared dynamic filter.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent d766b8d commit 1a87e76
5 files changed
Lines changed: 171 additions & 1 deletion
File tree
- datafusion
- core/tests/physical_optimizer
- proto
- proto
- src
- generated
- physical_plan
Lines changed: 115 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3383 | 3383 | | |
3384 | 3384 | | |
3385 | 3385 | | |
| 3386 | + | |
| 3387 | + | |
| 3388 | + | |
3386 | 3389 | | |
3387 | 3390 | | |
3388 | 3391 | | |
3389 | 3392 | | |
3390 | 3393 | | |
| 3394 | + | |
3391 | 3395 | | |
3392 | 3396 | | |
3393 | 3397 | | |
3394 | 3398 | | |
3395 | 3399 | | |
3396 | 3400 | | |
3397 | 3401 | | |
| 3402 | + | |
3398 | 3403 | | |
3399 | 3404 | | |
3400 | 3405 | | |
| |||
3465 | 3470 | | |
3466 | 3471 | | |
3467 | 3472 | | |
| 3473 | + | |
| 3474 | + | |
| 3475 | + | |
| 3476 | + | |
| 3477 | + | |
| 3478 | + | |
| 3479 | + | |
| 3480 | + | |
| 3481 | + | |
| 3482 | + | |
| 3483 | + | |
| 3484 | + | |
| 3485 | + | |
| 3486 | + | |
| 3487 | + | |
| 3488 | + | |
| 3489 | + | |
| 3490 | + | |
| 3491 | + | |
| 3492 | + | |
| 3493 | + | |
| 3494 | + | |
| 3495 | + | |
| 3496 | + | |
| 3497 | + | |
| 3498 | + | |
| 3499 | + | |
| 3500 | + | |
| 3501 | + | |
| 3502 | + | |
| 3503 | + | |
| 3504 | + | |
| 3505 | + | |
| 3506 | + | |
| 3507 | + | |
| 3508 | + | |
| 3509 | + | |
| 3510 | + | |
| 3511 | + | |
| 3512 | + | |
| 3513 | + | |
| 3514 | + | |
| 3515 | + | |
| 3516 | + | |
| 3517 | + | |
| 3518 | + | |
| 3519 | + | |
| 3520 | + | |
| 3521 | + | |
| 3522 | + | |
| 3523 | + | |
| 3524 | + | |
| 3525 | + | |
| 3526 | + | |
| 3527 | + | |
| 3528 | + | |
| 3529 | + | |
| 3530 | + | |
| 3531 | + | |
| 3532 | + | |
| 3533 | + | |
| 3534 | + | |
| 3535 | + | |
| 3536 | + | |
| 3537 | + | |
| 3538 | + | |
| 3539 | + | |
| 3540 | + | |
| 3541 | + | |
| 3542 | + | |
| 3543 | + | |
| 3544 | + | |
| 3545 | + | |
| 3546 | + | |
| 3547 | + | |
| 3548 | + | |
| 3549 | + | |
| 3550 | + | |
| 3551 | + | |
| 3552 | + | |
| 3553 | + | |
| 3554 | + | |
| 3555 | + | |
| 3556 | + | |
| 3557 | + | |
| 3558 | + | |
| 3559 | + | |
| 3560 | + | |
| 3561 | + | |
| 3562 | + | |
| 3563 | + | |
| 3564 | + | |
| 3565 | + | |
| 3566 | + | |
| 3567 | + | |
| 3568 | + | |
| 3569 | + | |
| 3570 | + | |
3468 | 3571 | | |
3469 | 3572 | | |
3470 | 3573 | | |
| |||
3477 | 3580 | | |
3478 | 3581 | | |
3479 | 3582 | | |
| 3583 | + | |
| 3584 | + | |
| 3585 | + | |
| 3586 | + | |
| 3587 | + | |
| 3588 | + | |
| 3589 | + | |
| 3590 | + | |
| 3591 | + | |
| 3592 | + | |
| 3593 | + | |
| 3594 | + | |
3480 | 3595 | | |
3481 | 3596 | | |
3482 | 3597 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1352 | 1352 | | |
1353 | 1353 | | |
1354 | 1354 | | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
1355 | 1360 | | |
1356 | 1361 | | |
1357 | 1362 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1680 | 1680 | | |
1681 | 1681 | | |
1682 | 1682 | | |
1683 | | - | |
| 1683 | + | |
| 1684 | + | |
1684 | 1685 | | |
1685 | 1686 | | |
1686 | 1687 | | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
| 1693 | + | |
| 1694 | + | |
| 1695 | + | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
1687 | 1705 | | |
1688 | 1706 | | |
1689 | 1707 | | |
| |||
3125 | 3143 | | |
3126 | 3144 | | |
3127 | 3145 | | |
| 3146 | + | |
| 3147 | + | |
| 3148 | + | |
| 3149 | + | |
| 3150 | + | |
| 3151 | + | |
| 3152 | + | |
3128 | 3153 | | |
3129 | 3154 | | |
3130 | 3155 | | |
| |||
3135 | 3160 | | |
3136 | 3161 | | |
3137 | 3162 | | |
| 3163 | + | |
3138 | 3164 | | |
3139 | 3165 | | |
3140 | 3166 | | |
| |||
0 commit comments