Skip to content

Commit 1429c92

Browse files
adriangbDandandan
andauthored
Dynamic filter pushdown for TopK sorts (#15770)
Co-authored-by: Daniël Heres <[email protected]>
1 parent 0c3bb78 commit 1429c92

File tree

21 files changed

+1003
-60
lines changed

21 files changed

+1003
-60
lines changed

datafusion/common/src/config.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,13 @@ config_namespace! {
614614
/// during aggregations, if possible
615615
pub enable_topk_aggregation: bool, default = true
616616

617+
/// When set to true attempts to push down dynamic filters generated by operators into the file scan phase.
618+
/// For example, for a query such as `SELECT * FROM t ORDER BY timestamp DESC LIMIT 10`, the optimizer
619+
/// will attempt to push down the current top 10 timestamps that the TopK operator references into the file scans.
620+
/// This means that if we already have 10 timestamps in the year 2025
621+
/// any files that only have timestamps in the year 2024 can be skipped / pruned at various stages in the scan.
622+
pub enable_dynamic_filter_pushdown: bool, default = true
623+
617624
/// When set to true, the optimizer will insert filters before a join between
618625
/// a nullable and non-nullable column to filter out nulls on the nullable side. This
619626
/// filter can add additional overhead when the file format does not fully support

datafusion/core/tests/fuzz_cases/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ mod join_fuzz;
2121
mod merge_fuzz;
2222
mod sort_fuzz;
2323
mod sort_query_fuzz;
24+
mod topk_filter_pushdown;
2425

2526
mod aggregation_fuzzer;
2627
mod equivalence;

0 commit comments

Comments
 (0)