HaoYang670 commented on code in PR #4753:
URL: https://github.com/apache/arrow-datafusion/pull/4753#discussion_r1058694733


##########
datafusion/core/src/physical_plan/planner.rs:
##########
@@ -773,12 +773,19 @@ impl DefaultPhysicalPlanner {
                     )?;
                     Ok(Arc::new(FilterExec::try_new(runtime_expr, 
physical_input)?))
                 }
-                LogicalPlan::Union(Union { inputs, .. }) => {
+                LogicalPlan::Union(Union { inputs, schema }) => {
                     let physical_plans = futures::stream::iter(inputs)
                         .then(|lp| self.create_initial_plan(lp, session_state))
                         .try_collect::<Vec<_>>()
                         .await?;
-                    Ok(Arc::new(UnionExec::new(physical_plans)))
+                    if schema.fields().len() < 
physical_plans[0].schema().fields().len() {

Review Comment:
   The original implementation ignores the top level schema, but I don't know 
why. (Maybe @gandronchik knows more about it). So I try to minimize the scope 
of this change to avoid introducing new bugs.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to