From 33272c597902e74209acc28a148bb661886faa05 Mon Sep 17 00:00:00 2001 From: itsjunetime Date: Thu, 26 Sep 2024 00:33:21 -0600 Subject: [PATCH] Compare schema as logically equivalent to workaround disappearing metadata --- datafusion/core/src/physical_planner.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/datafusion/core/src/physical_planner.rs b/datafusion/core/src/physical_planner.rs index b2b912d8add2..a0103f170e7f 100644 --- a/datafusion/core/src/physical_planner.rs +++ b/datafusion/core/src/physical_planner.rs @@ -69,7 +69,7 @@ use arrow_array::RecordBatch; use datafusion_common::display::ToStringifiedPlan; use datafusion_common::{ exec_err, internal_datafusion_err, internal_err, not_impl_err, plan_err, DFSchema, - ScalarValue, + ScalarValue, SchemaExt, }; use datafusion_expr::dml::CopyTo; use datafusion_expr::expr::{ @@ -673,7 +673,9 @@ impl DefaultPhysicalPlanner { let physical_input_schema_from_logical: Arc = logical_input_schema.as_ref().clone().into(); - if physical_input_schema != physical_input_schema_from_logical { + if !physical_input_schema.logically_equivalent_names_and_types( + &physical_input_schema_from_logical, + ) { return internal_err!("Physical input schema should be the same as the one converted from logical input schema."); }