Skip to content

Commit

Permalink
refactor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewgapp committed Nov 18, 2023
1 parent 09825d5 commit b7e59f7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 32 deletions.
48 changes: 24 additions & 24 deletions datafusion/core/src/physical_optimizer/enforce_distribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1114,29 +1114,29 @@ fn remove_dist_changing_operators(
})
}

/// Changes each child of the `dist_context.plan` such that they no longer
/// use order preserving variants, if no ordering is required at the output
/// of the physical plan (there is no global ordering requirement by the query).
fn update_plan_to_remove_unnecessary_final_order(
dist_context: DistributionContext,
) -> Result<Arc<dyn ExecutionPlan>> {
let DistributionContext {
plan,
distribution_onwards,
..
} = dist_context;
let new_children = izip!(plan.children(), distribution_onwards)
.map(|(mut child, mut dist_onward)| {
replace_order_preserving_variants(&mut child, &mut dist_onward)?;
Ok(child)
})
.collect::<Result<Vec<_>>>()?;
if !new_children.is_empty() {
plan.with_new_children(new_children)
} else {
Ok(plan)
}
}
// /// Changes each child of the `dist_context.plan` such that they no longer
// /// use order preserving variants, if no ordering is required at the output
// /// of the physical plan (there is no global ordering requirement by the query).
// fn update_plan_to_remove_unnecessary_final_order(
// dist_context: DistributionContext,
// ) -> Result<Arc<dyn ExecutionPlan>> {
// let DistributionContext {
// plan,
// distribution_onwards,
// ..
// } = dist_context;
// let new_children = izip!(plan.children(), distribution_onwards)
// .map(|(mut child, mut dist_onward)| {
// replace_order_preserving_variants(&mut child, &mut dist_onward)?;
// Ok(child)
// })
// .collect::<Result<Vec<_>>>()?;
// if !new_children.is_empty() {
// plan.with_new_children(new_children)
// } else {
// Ok(plan)
// }
// }

/// Updates the physical plan `input` by using `dist_onward` replace order preserving operator variants
/// with their corresponding operators that do not preserve order. It is a wrapper for `replace_order_preserving_variants_helper`
Expand Down Expand Up @@ -1228,7 +1228,7 @@ fn ensure_distribution(
mut plan,
mut distribution_onwards,
has_recursive_ancestor,
} = remove_unnecessary_repartition(dist_context)?;
} = remove_dist_changing_operators(dist_context)?;

if let Some(exec) = plan.as_any().downcast_ref::<WindowAggExec>() {
if let Some(updated_window) = get_best_fitting_window(
Expand Down
8 changes: 0 additions & 8 deletions datafusion/proto/src/physical_plan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@ use datafusion::physical_plan::windows::{
use datafusion::physical_plan::{
udaf, AggregateExpr, ExecutionPlan, Partitioning, PhysicalExpr, WindowExpr,
};
<<<<<<< HEAD
<<<<<<< HEAD
=======
// use datafusion::physical_plan::con
=======
>>>>>>> f9614d09e (Continuing implementation with fixes and improvements)
use datafusion_common::FileCompressionType;
>>>>>>> 7d3565a4c (partway through porting over isidentical's work)
use datafusion_common::{internal_err, not_impl_err, DataFusionError, Result};
use prost::bytes::BufMut;
use prost::Message;
Expand Down

0 comments on commit b7e59f7

Please sign in to comment.