Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
4675c43
Push TopK (Sort with fetch) through outer joins
Apr 14, 2026
9aede67
lint fix
Apr 14, 2026
3899d6a
Merge branch 'main' into push-down-topk-through-join
Apr 14, 2026
19b0edc
fix build failure
Apr 14, 2026
367d8a5
Merge branch 'main' into push-down-topk-through-join
Apr 17, 2026
baf25ef
Handle edge cases
Apr 17, 2026
67f9265
Handle volatile expr early
Apr 17, 2026
0ca184e
Merge branch 'main' into push-down-topk-through-join
Apr 17, 2026
16f61cf
Merge branch 'main' into push-down-topk-through-join
SubhamSinghal Apr 17, 2026
d12aefa
Fix build failure
Apr 17, 2026
902ef77
Handle subquery alias
Apr 18, 2026
6b232e1
Merge branch 'main' into push-down-topk-through-join
Apr 18, 2026
254b224
Update comment
Apr 18, 2026
c648e71
Doc fix
Apr 18, 2026
34832c8
Merge branch 'main' into push-down-topk-through-join
SubhamSinghal Apr 19, 2026
e02b82a
Merge branch 'main' into push-down-topk-through-join
SubhamSinghal Apr 20, 2026
03f6499
Handle volatile expr in projection
Apr 21, 2026
e051707
Merge branch 'main' into push-down-topk-through-join
Apr 21, 2026
051868a
use structural equality
Apr 21, 2026
1cfeb76
Adds UT
Apr 21, 2026
c6edd07
Merge branch 'main' into push-down-topk-through-join
SubhamSinghal May 2, 2026
f72d845
Merge branch 'main' into push-down-topk-through-join
SubhamSinghal May 5, 2026
0371004
Fix UT
May 6, 2026
5d62f22
Merge branch 'main' into push-down-topk-through-join
May 9, 2026
38bbf87
Resolve comment
May 9, 2026
036fb9f
Merge branch 'main' into push-down-topk-through-join
May 9, 2026
8d4fc2c
Adds back missing UT
May 9, 2026
53662c1
Merge branch 'main' into push-down-topk-through-join
blaginin May 9, 2026
80f84bc
Fix explain slt test
May 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions datafusion/core/src/optimizer_rule_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,13 @@ Rule order matters. The default pipeline may change between releases.
| 16 | `eliminate_outer_join` | Rewrites outer joins to inner joins when later filters reject the NULL-extended rows. |
| 17 | `push_down_limit` | Moves literal limits closer to scans and unions and merges adjacent limits. |
| 18 | `push_down_filter` | Moves filters as early as possible through filter-commutative operators. |
| 19 | `single_distinct_aggregation_to_group_by` | Rewrites single-column `DISTINCT` aggregations into two-stage `GROUP BY` plans. |
| 20 | `eliminate_group_by_constant` | Removes constant or functionally redundant expressions from `GROUP BY`. |
| 21 | `common_sub_expression_eliminate` | Computes repeated subexpressions once and reuses the result. |
| 22 | `extract_leaf_expressions` | Pulls cheap leaf expressions closer to data sources so later pruning and filter rules can act earlier. |
| 23 | `push_down_leaf_projections` | Pushes the helper projections created by leaf extraction toward leaf inputs. |
| 24 | `optimize_projections` | Prunes unused columns and removes unnecessary logical projections. |
| 19 | `push_down_topk_through_join` | Pushes Sort with LIMIT through joins when sort columns come from the preserved side. |
| 20 | `single_distinct_aggregation_to_group_by` | Rewrites single-column `DISTINCT` aggregations into two-stage `GROUP BY` plans. |
| 21 | `eliminate_group_by_constant` | Removes constant or functionally redundant expressions from `GROUP BY`. |
| 22 | `common_sub_expression_eliminate` | Computes repeated subexpressions once and reuses the result. |
| 23 | `extract_leaf_expressions` | Pulls cheap leaf expressions closer to data sources so later pruning and filter rules can act earlier. |
| 24 | `push_down_leaf_projections` | Pushes the helper projections created by leaf extraction toward leaf inputs. |
| 25 | `optimize_projections` | Prunes unused columns and removes unnecessary logical projections. |

### Physical Optimizer Rules

Expand Down
1 change: 1 addition & 0 deletions datafusion/optimizer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ pub mod optimizer;
pub mod propagate_empty_relation;
pub mod push_down_filter;
pub mod push_down_limit;
pub mod push_down_topk_through_join;
pub mod replace_distinct_aggregate;
pub mod rewrite_set_comparison;
pub mod scalar_subquery_to_join;
Expand Down
2 changes: 2 additions & 0 deletions datafusion/optimizer/src/optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ use crate::plan_signature::LogicalPlanSignature;
use crate::propagate_empty_relation::PropagateEmptyRelation;
use crate::push_down_filter::PushDownFilter;
use crate::push_down_limit::PushDownLimit;
use crate::push_down_topk_through_join::PushDownTopKThroughJoin;
use crate::replace_distinct_aggregate::ReplaceDistinctWithAggregate;
use crate::rewrite_set_comparison::RewriteSetComparison;
use crate::scalar_subquery_to_join::ScalarSubqueryToJoin;
Expand Down Expand Up @@ -297,6 +298,7 @@ impl Optimizer {
// Filters can't be pushed down past Limits, we should do PushDownFilter after PushDownLimit
Arc::new(PushDownLimit::new()),
Arc::new(PushDownFilter::new()),
Arc::new(PushDownTopKThroughJoin::new()),
Arc::new(SingleDistinctToGroupBy::new()),
// The previous optimizations added expressions and projections,
// that might benefit from the following rules
Expand Down
Loading
Loading