diff --git a/datafusion-cli/src/exec.rs b/datafusion-cli/src/exec.rs index 1869e15ef584..63862caab82a 100644 --- a/datafusion-cli/src/exec.rs +++ b/datafusion-cli/src/exec.rs @@ -221,14 +221,11 @@ async fn exec_and_print( | LogicalPlan::Analyze(_) ); - let df = match &plan { - LogicalPlan::Ddl(DdlStatement::CreateExternalTable(cmd)) => { - create_external_table(ctx, cmd).await?; - ctx.execute_logical_plan(plan).await? - } - _ => ctx.execute_logical_plan(plan).await?, - }; + if let LogicalPlan::Ddl(DdlStatement::CreateExternalTable(cmd)) = &plan { + create_external_table(ctx, cmd).await?; + } + let df = ctx.execute_logical_plan(plan).await?; let results = df.collect().await?; let print_options = if should_ignore_maxrows { diff --git a/datafusion/core/src/physical_planner.rs b/datafusion/core/src/physical_planner.rs index 9e64eb9c5108..0e96b126b967 100644 --- a/datafusion/core/src/physical_planner.rs +++ b/datafusion/core/src/physical_planner.rs @@ -86,7 +86,7 @@ use datafusion_expr::expr::{ Cast, GetFieldAccess, GetIndexedField, GroupingSet, InList, Like, TryCast, WindowFunction, }; -use datafusion_expr::expr_rewriter::{unalias, unnormalize_cols}; +use datafusion_expr::expr_rewriter::unnormalize_cols; use datafusion_expr::logical_plan::builder::wrap_projection_for_join_if_necessary; use datafusion_expr::{ DescribeTable, DmlStatement, ScalarFunctionDefinition, StringifiedPlan, WindowFrame, @@ -562,8 +562,7 @@ impl DefaultPhysicalPlanner { // doesn't know (nor should care) how the relation was // referred to in the query let filters = unnormalize_cols(filters.iter().cloned()); - let unaliased: Vec = filters.into_iter().map(unalias).collect(); - source.scan(session_state, projection.as_ref(), &unaliased, *fetch).await + source.scan(session_state, projection.as_ref(), &filters, *fetch).await } LogicalPlan::Copy(CopyTo{ input, diff --git a/datafusion/physical-expr/src/array_expressions.rs b/datafusion/physical-expr/src/array_expressions.rs index 84dfe3b9ff75..e21b4a102d73 100644 --- a/datafusion/physical-expr/src/array_expressions.rs +++ b/datafusion/physical-expr/src/array_expressions.rs @@ -586,14 +586,14 @@ fn general_array_pop( ) -> Result<(Vec, Vec)> { if from_back { let key = vec![0; list_array.len()]; - // Atttetion: `arr.len() - 1` in extra key defines the last element position (position = index + 1, not inclusive) we want in the new array. + // Attention: `arr.len() - 1` in extra key defines the last element position (position = index + 1, not inclusive) we want in the new array. let extra_key: Vec<_> = list_array .iter() .map(|x| x.map_or(0, |arr| arr.len() as i64 - 1)) .collect(); Ok((key, extra_key)) } else { - // Atttetion: 2 in the `key`` defines the first element position (position = index + 1) we want in the new array. + // Attention: 2 in the `key`` defines the first element position (position = index + 1) we want in the new array. // We only handle two cases of the first element index: if the old array has any elements, starts from 2 (index + 1), or starts from initial. let key: Vec<_> = list_array.iter().map(|x| x.map_or(0, |_| 2)).collect(); let extra_key: Vec<_> = list_array @@ -1405,7 +1405,7 @@ pub fn array_replace_n(args: &[ArrayRef]) -> Result { } pub fn array_replace_all(args: &[ArrayRef]) -> Result { - // replace all occurences (up to "i64::MAX") + // replace all occurrences (up to "i64::MAX") let arr_n = vec![i64::MAX; args[0].len()]; general_replace(as_list_array(&args[0])?, &args[1], &args[2], arr_n) }