From 78401dfeeb028af68409cf86bb06b5c783abe83d Mon Sep 17 00:00:00 2001 From: jakevin Date: Sat, 19 Nov 2022 03:43:57 +0800 Subject: [PATCH] MINOR: replace `{..}` with `(_)`, typo, remove outdated TODO (#4286) * replace `{..}` with `(_)` * remove todo * typo --- datafusion/core/src/physical_plan/planner.rs | 8 ++------ .../core/src/physical_plan/windows/window_agg_exec.rs | 1 - datafusion/expr/src/logical_plan/plan.rs | 8 ++++---- datafusion/optimizer/src/common_subexpr_eliminate.rs | 10 +++++----- datafusion/optimizer/src/projection_push_down.rs | 10 +++++----- 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/datafusion/core/src/physical_plan/planner.rs b/datafusion/core/src/physical_plan/planner.rs index 757ab7205ea2..b30b8ca82d1e 100644 --- a/datafusion/core/src/physical_plan/planner.rs +++ b/datafusion/core/src/physical_plan/planner.rs @@ -711,7 +711,7 @@ impl DefaultPhysicalPlanner { // provided expressions into logical Column expressions if their results // are already provided from the input plans. Because we work with // qualified columns in logical plane, derived columns involve operators or - // functions will contain qualifers as well. This will result in logical + // functions will contain qualifiers as well. This will result in logical // columns with names like `SUM(t1.c1)`, `t1.c1 + t1.c2`, etc. // // If we run these logical columns through physical_name function, we will @@ -2281,11 +2281,7 @@ mod tests { unimplemented!("NoOpExecutionPlan::execute"); } - fn fmt_as( - &self, - t: DisplayFormatType, - f: &mut std::fmt::Formatter, - ) -> std::fmt::Result { + fn fmt_as(&self, t: DisplayFormatType, f: &mut fmt::Formatter) -> fmt::Result { match t { DisplayFormatType::Default => { write!(f, "NoOpExecutionPlan") diff --git a/datafusion/core/src/physical_plan/windows/window_agg_exec.rs b/datafusion/core/src/physical_plan/windows/window_agg_exec.rs index 248c4570daf5..8f0b5364f817 100644 --- a/datafusion/core/src/physical_plan/windows/window_agg_exec.rs +++ b/datafusion/core/src/physical_plan/windows/window_agg_exec.rs @@ -214,7 +214,6 @@ impl ExecutionPlan for WindowAggExec { is_exact: input_stat.is_exact, num_rows: input_stat.num_rows, column_statistics: Some(column_statistics), - // TODO stats: knowing the type of the new columns we can guess the output size total_byte_size: None, } } diff --git a/datafusion/expr/src/logical_plan/plan.rs b/datafusion/expr/src/logical_plan/plan.rs index 12c1f96671de..341e879fa901 100644 --- a/datafusion/expr/src/logical_plan/plan.rs +++ b/datafusion/expr/src/logical_plan/plan.rs @@ -106,7 +106,7 @@ pub enum LogicalPlan { Extension(Extension), /// Remove duplicate rows from the input Distinct(Distinct), - /// Set a Varaible + /// Set a Variable SetVariable(SetVariable), } @@ -254,7 +254,7 @@ impl LogicalPlan { LogicalPlan::Sort(Sort { expr, .. }) => expr.clone(), LogicalPlan::Extension(extension) => extension.node.expressions(), // plans without expressions - LogicalPlan::TableScan { .. } + LogicalPlan::TableScan(_) | LogicalPlan::EmptyRelation(_) | LogicalPlan::Subquery(_) | LogicalPlan::SubqueryAlias(_) @@ -268,8 +268,8 @@ impl LogicalPlan { | LogicalPlan::SetVariable(_) | LogicalPlan::DropView(_) | LogicalPlan::CrossJoin(_) - | LogicalPlan::Analyze { .. } - | LogicalPlan::Explain { .. } + | LogicalPlan::Analyze(_) + | LogicalPlan::Explain(_) | LogicalPlan::Union(_) | LogicalPlan::Distinct(_) => { vec![] diff --git a/datafusion/optimizer/src/common_subexpr_eliminate.rs b/datafusion/optimizer/src/common_subexpr_eliminate.rs index 8369c12c3c6a..0ba976c08163 100644 --- a/datafusion/optimizer/src/common_subexpr_eliminate.rs +++ b/datafusion/optimizer/src/common_subexpr_eliminate.rs @@ -221,19 +221,19 @@ impl OptimizerRule for CommonSubexprEliminate { fetch: *fetch, })) } - LogicalPlan::Join { .. } + LogicalPlan::Join(_) | LogicalPlan::CrossJoin(_) | LogicalPlan::Repartition(_) | LogicalPlan::Union(_) - | LogicalPlan::TableScan { .. } + | LogicalPlan::TableScan(_) | LogicalPlan::Values(_) | LogicalPlan::EmptyRelation(_) | LogicalPlan::Subquery(_) | LogicalPlan::SubqueryAlias(_) | LogicalPlan::Limit(_) | LogicalPlan::CreateExternalTable(_) - | LogicalPlan::Explain { .. } - | LogicalPlan::Analyze { .. } + | LogicalPlan::Explain(_) + | LogicalPlan::Analyze(_) | LogicalPlan::CreateMemoryTable(_) | LogicalPlan::CreateView(_) | LogicalPlan::CreateCatalogSchema(_) @@ -242,7 +242,7 @@ impl OptimizerRule for CommonSubexprEliminate { | LogicalPlan::DropView(_) | LogicalPlan::SetVariable(_) | LogicalPlan::Distinct(_) - | LogicalPlan::Extension { .. } => { + | LogicalPlan::Extension(_) => { // apply the optimization to all inputs of the plan utils::optimize_children(self, plan, optimizer_config) } diff --git a/datafusion/optimizer/src/projection_push_down.rs b/datafusion/optimizer/src/projection_push_down.rs index 5244bbcdbd79..874e042e46ab 100644 --- a/datafusion/optimizer/src/projection_push_down.rs +++ b/datafusion/optimizer/src/projection_push_down.rs @@ -112,9 +112,9 @@ fn get_projected_schema( // create the projected schema let projected_fields: Vec = match table_name { - Some(qualifer) => projection + Some(qualifier) => projection .iter() - .map(|i| DFField::from_qualified(qualifer, schema.fields()[*i].clone())) + .map(|i| DFField::from_qualified(qualifier, schema.fields()[*i].clone())) .collect(), None => projection .iter() @@ -610,7 +610,7 @@ mod tests { } #[test] - fn redundunt_project() -> Result<()> { + fn redundant_project() -> Result<()> { let table_scan = test_table_scan()?; let plan = LogicalPlanBuilder::from(table_scan) @@ -641,7 +641,7 @@ mod tests { } #[test] - fn noncontiguous_redundunt_projection() -> Result<()> { + fn noncontinuous_redundant_projection() -> Result<()> { let table_scan = test_table_scan()?; let plan = LogicalPlanBuilder::from(table_scan) @@ -747,7 +747,7 @@ mod tests { #[test] fn join_schema_trim_using_join() -> Result<()> { - // shared join colums from using join should be pushed to both sides + // shared join columns from using join should be pushed to both sides let table_scan = test_table_scan()?;