Skip to content

Commit

Permalink
chore: Move CoalesceBatches from core to optimizer crate (#13283)
Browse files Browse the repository at this point in the history
* move coalesce batches

* small fix
  • Loading branch information
jonathanc-n authored Nov 8, 2024
1 parent c1b6f78 commit d00a085
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion datafusion/core/src/physical_optimizer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
//! "Repartition" or "Sortedness"
//!
//! [`ExecutionPlan`]: crate::physical_plan::ExecutionPlan
pub mod coalesce_batches;
pub mod enforce_distribution;
pub mod enforce_sorting;
pub mod join_selection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
//! CoalesceBatches optimizer that groups batches together rows
//! in bigger batches to avoid overhead with small batches
use crate::PhysicalOptimizerRule;

use std::sync::Arc;

use crate::{
config::ConfigOptions,
error::Result,
physical_plan::{
coalesce_batches::CoalesceBatchesExec, filter::FilterExec, joins::HashJoinExec,
repartition::RepartitionExec, Partitioning,
},
use datafusion_common::config::ConfigOptions;
use datafusion_common::error::Result;
use datafusion_physical_expr::Partitioning;
use datafusion_physical_plan::{
coalesce_batches::CoalesceBatchesExec, filter::FilterExec, joins::HashJoinExec,
repartition::RepartitionExec, ExecutionPlan,
};

use datafusion_common::tree_node::{Transformed, TransformedResult, TreeNode};
use datafusion_physical_optimizer::PhysicalOptimizerRule;

/// Optimizer rule that introduces CoalesceBatchesExec to avoid overhead with small batches that
/// are produced by highly selective filters
Expand All @@ -46,9 +46,9 @@ impl CoalesceBatches {
impl PhysicalOptimizerRule for CoalesceBatches {
fn optimize(
&self,
plan: Arc<dyn crate::physical_plan::ExecutionPlan>,
plan: Arc<dyn ExecutionPlan>,
config: &ConfigOptions,
) -> Result<Arc<dyn crate::physical_plan::ExecutionPlan>> {
) -> Result<Arc<dyn ExecutionPlan>> {
if !config.execution.coalesce_batches {
return Ok(plan);
}
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 @@ -19,6 +19,7 @@
#![deny(clippy::clone_on_ref_ptr)]

pub mod aggregate_statistics;
pub mod coalesce_batches;
pub mod combine_partial_final_agg;
pub mod limit_pushdown;
pub mod limited_distinct_aggregation;
Expand Down

0 comments on commit d00a085

Please sign in to comment.