Skip to content

Commit d00a085

Browse files
authored
chore: Move CoalesceBatches from core to optimizer crate (apache#13283)
* move coalesce batches * small fix
1 parent c1b6f78 commit d00a085

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

datafusion/core/src/physical_optimizer/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
//! "Repartition" or "Sortedness"
2222
//!
2323
//! [`ExecutionPlan`]: crate::physical_plan::ExecutionPlan
24-
pub mod coalesce_batches;
24+
2525
pub mod enforce_distribution;
2626
pub mod enforce_sorting;
2727
pub mod join_selection;

datafusion/core/src/physical_optimizer/coalesce_batches.rs datafusion/physical-optimizer/src/coalesce_batches.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@
1818
//! CoalesceBatches optimizer that groups batches together rows
1919
//! in bigger batches to avoid overhead with small batches
2020
21+
use crate::PhysicalOptimizerRule;
22+
2123
use std::sync::Arc;
2224

23-
use crate::{
24-
config::ConfigOptions,
25-
error::Result,
26-
physical_plan::{
27-
coalesce_batches::CoalesceBatchesExec, filter::FilterExec, joins::HashJoinExec,
28-
repartition::RepartitionExec, Partitioning,
29-
},
25+
use datafusion_common::config::ConfigOptions;
26+
use datafusion_common::error::Result;
27+
use datafusion_physical_expr::Partitioning;
28+
use datafusion_physical_plan::{
29+
coalesce_batches::CoalesceBatchesExec, filter::FilterExec, joins::HashJoinExec,
30+
repartition::RepartitionExec, ExecutionPlan,
3031
};
3132

3233
use datafusion_common::tree_node::{Transformed, TransformedResult, TreeNode};
33-
use datafusion_physical_optimizer::PhysicalOptimizerRule;
3434

3535
/// Optimizer rule that introduces CoalesceBatchesExec to avoid overhead with small batches that
3636
/// are produced by highly selective filters
@@ -46,9 +46,9 @@ impl CoalesceBatches {
4646
impl PhysicalOptimizerRule for CoalesceBatches {
4747
fn optimize(
4848
&self,
49-
plan: Arc<dyn crate::physical_plan::ExecutionPlan>,
49+
plan: Arc<dyn ExecutionPlan>,
5050
config: &ConfigOptions,
51-
) -> Result<Arc<dyn crate::physical_plan::ExecutionPlan>> {
51+
) -> Result<Arc<dyn ExecutionPlan>> {
5252
if !config.execution.coalesce_batches {
5353
return Ok(plan);
5454
}

datafusion/physical-optimizer/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#![deny(clippy::clone_on_ref_ptr)]
2020

2121
pub mod aggregate_statistics;
22+
pub mod coalesce_batches;
2223
pub mod combine_partial_final_agg;
2324
pub mod limit_pushdown;
2425
pub mod limited_distinct_aggregation;

0 commit comments

Comments
 (0)