Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 17 additions & 0 deletions datafusion/common/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,17 @@ config_namespace! {
///
/// Disabled by default, set to a number greater than 0 for enabling it.
pub hash_join_buffering_capacity: usize, default = 0

/// Number of input streams to prefetch ahead-of-time for `ProgressiveEvalExec`.
/// Since `ProgressiveEvalExec` only polls one stream at a time in order,
/// we do not need to prefetch all streams at once, saving resources. However, if the
/// streams' IO time is much greater than their CPU/processing time, prefetching them will
/// help improve performance.
/// Default is 1 which means we will prefetch one extra stream before it is polled.
/// 0 means streams are only fetched immediately before they are required.
/// Increase this value if IO time to read a stream is often much more than CPU time to
/// process the previous one.
pub progressive_eval_num_prefetch_input_streams: usize, default = 1
}
}

Expand Down Expand Up @@ -1753,6 +1764,12 @@ config_namespace! {
/// Default: true
pub enable_sort_pushdown: bool, default = true

/// When set to true, the physical plan optimizer will replace
/// `SortPreservingMergeExec` with `ProgressiveEvalExec` when the input
/// partitions are non-overlapping ranges of the merge ordering,
/// avoiding a merge by emitting the partitions sequentially.
pub sequence_sorted_inputs: bool, default = false

/// When set to true, the optimizer will extract leaf expressions
/// (such as `get_field`) from filter/sort/join nodes into projections
/// closer to the leaf table scans, and push those projections down
Expand Down
1 change: 1 addition & 0 deletions datafusion/physical-optimizer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub use datafusion_pruning as pruning;
pub mod hash_join_buffering;
pub mod pushdown_sort;
pub mod sanity_checker;
pub mod sequence_sorted_inputs;
pub mod topk_aggregation;
pub mod topk_repartition;
pub mod update_aggr_exprs;
Expand Down
5 changes: 5 additions & 0 deletions datafusion/physical-optimizer/src/optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ use crate::update_aggr_exprs::OptimizeAggregateOrder;
use crate::hash_join_buffering::HashJoinBuffering;
use crate::limit_pushdown_past_window::LimitPushPastWindows;
use crate::pushdown_sort::PushdownSort;
use crate::sequence_sorted_inputs::SequenceSortedInputs;
use crate::window_topn::WindowTopN;
use datafusion_common::config::ConfigOptions;

Expand Down Expand Up @@ -174,6 +175,10 @@ impl PhysicalOptimizer {
Arc::new(ProjectionPushdown::new()),
// PushdownSort: Detect sorts that can be pushed down to data sources.
Arc::new(PushdownSort::new()),
// SequenceSortedInputs: Replace SortPreservingMergeExec with ProgressiveEvalExec
// for partitions that don't overlap in the sort columns.
// Runs after PushdownSort which might introduce a SortPreservingMergeExec.
Arc::new(SequenceSortedInputs::new()),
Arc::new(EnsureCooperative::new()),
// This FilterPushdown handles dynamic filters that may have references to the source ExecutionPlan.
// Therefore, it should be run at the end of the optimization process since any changes to the plan may break the dynamic filter's references.
Expand Down
Loading
Loading