From e0724dde686ebf4b98092002ded5288a685820a4 Mon Sep 17 00:00:00 2001 From: Matthew Gapp <61894094+matthewgapp@users.noreply.github.com> Date: Mon, 8 Jan 2024 21:48:17 -0800 Subject: [PATCH] wip: fixes after rebase but tpcds_physical_q54 keeps overflowing its stack --- datafusion/core/src/physical_planner.rs | 2 +- datafusion/optimizer/src/optimize_projections.rs | 2 ++ datafusion/physical-plan/src/recursive_query.rs | 1 + datafusion/sql/src/query.rs | 10 +++++----- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/datafusion/core/src/physical_planner.rs b/datafusion/core/src/physical_planner.rs index 01c6e6f306643..7c95ddd06b618 100644 --- a/datafusion/core/src/physical_planner.rs +++ b/datafusion/core/src/physical_planner.rs @@ -936,7 +936,7 @@ impl DefaultPhysicalPlanner { let filter = FilterExec::try_new(runtime_expr, physical_input)?; Ok(Arc::new(filter.with_default_selectivity(selectivity)?)) } - LogicalPlan::Union(Union { inputs, schema }) => { + LogicalPlan::Union(Union { inputs, schema: _ }) => { let physical_plans = self.create_initial_plan_multi(inputs.iter().map(|lp| lp.as_ref()), session_state, ctx).await?; Ok(Arc::new(UnionExec::new(physical_plans))) diff --git a/datafusion/optimizer/src/optimize_projections.rs b/datafusion/optimizer/src/optimize_projections.rs index 1d4eda0bd23e0..10a16ea722511 100644 --- a/datafusion/optimizer/src/optimize_projections.rs +++ b/datafusion/optimizer/src/optimize_projections.rs @@ -162,6 +162,8 @@ fn optimize_projections( .collect::>() } LogicalPlan::EmptyRelation(_) + | LogicalPlan::NamedRelation(_) + | LogicalPlan::RecursiveQuery(_) | LogicalPlan::Statement(_) | LogicalPlan::Values(_) | LogicalPlan::Extension(_) diff --git a/datafusion/physical-plan/src/recursive_query.rs b/datafusion/physical-plan/src/recursive_query.rs index b3aa1c7156eca..39b025f6e1f21 100644 --- a/datafusion/physical-plan/src/recursive_query.rs +++ b/datafusion/physical-plan/src/recursive_query.rs @@ -296,6 +296,7 @@ impl RecursiveQueryStream { Err(e) => { return Poll::Ready(Some(Err(DataFusionError::ArrowError( ArrowError::from_external_error(Box::new(e)), + None, )))); } } diff --git a/datafusion/sql/src/query.rs b/datafusion/sql/src/query.rs index 8bef4ea119384..0d0eb5b8753b9 100644 --- a/datafusion/sql/src/query.rs +++ b/datafusion/sql/src/query.rs @@ -23,8 +23,7 @@ use datafusion_common::{ plan_err, sql_err, Constraints, DFSchema, DataFusionError, Result, ScalarValue, }; use datafusion_expr::{ - logical_plan, CreateMemoryTable, DdlStatement, Distinct, Expr, LogicalPlan, - LogicalPlanBuilder, + CreateMemoryTable, DdlStatement, Distinct, Expr, LogicalPlan, LogicalPlanBuilder, }; use sqlparser::ast::{ Expr as SQLExpr, Offset as SQLOffset, OrderByExpr, Query, SetExpr, SetOperator, @@ -172,9 +171,10 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> { planner_context.insert_cte(cte_name.clone(), final_plan); } _ => { - return Err(DataFusionError::SQL(ParserError( - "Invalid recursive CTE".to_string(), - ))); + return Err(DataFusionError::SQL( + ParserError("Invalid recursive CTE".to_string()), + None, + )); } }; } else {