Commit a089eff
authored
refactor filter pushdown APIs (#16642)
This commit refactors the filter pushdown infrastructure to improve flexibility, readability, and maintainability:
### Major Changes:
- **Eliminated `PredicateSupports`** wrapper in favor of directly using `Vec<PredicateSupport>`, simplifying APIs.
- Introduced **`ChildFilterDescription::from_child`** to encapsulate logic for determining filter pushdown eligibility per child.
- Added **`FilterDescription::from_children`** to generate pushdown plans based on column references across all children.
- Replaced legacy methods (`all_parent_filters_supported`, etc.) with more flexible, composable APIs using builder-style chaining.
- Updated all relevant nodes (`FilterExec`, `SortExec`, `RepartitionExec`, etc.) to use the new pushdown planning structure.
### Functional Adjustments:
- Ensured filter column indices are reassigned properly when filters are pushed to projected inputs (e.g., in `FilterExec`).
- Standardized handling of supported vs. unsupported filters throughout the propagation pipeline.
- Improved handling of self-filters in nodes such as `FilterExec` and `SortExec`.
### Optimizer Improvements:
- Clarified pushdown phases (`Pre`, `Post`) and respected them across execution plans.
- Documented the full pushdown lifecycle within `filter_pushdown.rs`, improving discoverability for future contributors.
These changes lay the groundwork for more precise and flexible filter pushdown optimizations and improve the robustness of the optimizer infrastructure.1 parent e950df5 commit a089eff
File tree
11 files changed
+310
-380
lines changed- datafusion
- core/tests/physical_optimizer/filter_pushdown
- datasource-parquet/src
- datasource/src
- physical-optimizer/src
- physical-plan/src
- repartition
- sorts
11 files changed
+310
-380
lines changedLines changed: 19 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
| 37 | + | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
232 | 235 | | |
233 | 236 | | |
234 | 237 | | |
235 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
236 | 244 | | |
237 | 245 | | |
238 | 246 | | |
| |||
515 | 523 | | |
516 | 524 | | |
517 | 525 | | |
518 | | - | |
519 | | - | |
520 | | - | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
521 | 532 | | |
522 | 533 | | |
523 | 534 | | |
| |||
534 | 545 | | |
535 | 546 | | |
536 | 547 | | |
537 | | - | |
| 548 | + | |
538 | 549 | | |
539 | 550 | | |
540 | 551 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| |||
621 | 622 | | |
622 | 623 | | |
623 | 624 | | |
624 | | - | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
625 | 631 | | |
626 | 632 | | |
627 | 633 | | |
| |||
635 | 641 | | |
636 | 642 | | |
637 | 643 | | |
638 | | - | |
639 | | - | |
640 | | - | |
641 | | - | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
642 | 658 | | |
643 | 659 | | |
644 | 660 | | |
645 | 661 | | |
646 | | - | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
647 | 669 | | |
648 | | - | |
649 | | - | |
650 | | - | |
651 | | - | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
652 | 674 | | |
653 | 675 | | |
654 | 676 | | |
| |||
657 | 679 | | |
658 | 680 | | |
659 | 681 | | |
660 | | - | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
661 | 686 | | |
662 | 687 | | |
663 | 688 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
120 | 122 | | |
121 | 123 | | |
122 | 124 | | |
123 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
124 | 131 | | |
125 | 132 | | |
126 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
172 | 177 | | |
173 | 178 | | |
174 | 179 | | |
| |||
316 | 321 | | |
317 | 322 | | |
318 | 323 | | |
319 | | - | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
320 | 332 | | |
321 | 333 | | |
322 | 334 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
18 | 34 | | |
19 | 35 | | |
20 | 36 | | |
21 | 37 | | |
22 | 38 | | |
23 | 39 | | |
24 | 40 | | |
25 | | - | |
26 | | - | |
| 41 | + | |
27 | 42 | | |
28 | 43 | | |
29 | 44 | | |
30 | | - | |
| 45 | + | |
31 | 46 | | |
32 | 47 | | |
33 | 48 | | |
| |||
497 | 512 | | |
498 | 513 | | |
499 | 514 | | |
500 | | - | |
| 515 | + | |
501 | 516 | | |
502 | 517 | | |
503 | | - | |
| 518 | + | |
504 | 519 | | |
505 | 520 | | |
506 | 521 | | |
| |||
533 | 548 | | |
534 | 549 | | |
535 | 550 | | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
551 | 560 | | |
552 | 561 | | |
553 | 562 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
238 | | - | |
| 237 | + | |
239 | 238 | | |
240 | 239 | | |
241 | 240 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
| 20 | + | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
520 | 521 | | |
521 | 522 | | |
522 | 523 | | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
527 | 537 | | |
528 | 538 | | |
529 | 539 | | |
| |||
587 | 597 | | |
588 | 598 | | |
589 | 599 | | |
590 | | - | |
591 | | - | |
592 | 600 | | |
593 | 601 | | |
594 | 602 | | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
599 | | - | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
600 | 609 | | |
601 | 610 | | |
602 | 611 | | |
| |||
605 | 614 | | |
606 | 615 | | |
607 | 616 | | |
608 | | - | |
609 | 617 | | |
610 | 618 | | |
611 | 619 | | |
| |||
0 commit comments