yyy1000 commented on code in PR #10494:
URL: https://github.com/apache/datafusion/pull/10494#discussion_r1602098819


##########
datafusion/optimizer/src/propagate_empty_relation.rs:
##########
@@ -154,14 +156,14 @@ impl OptimizerRule for PropagateEmptyRelation {
                         Ok(Transformed::yes(LogicalPlan::Projection(
                             Projection::new_from_schema(
                                 Arc::new(child),
-                                plan.schema().clone(),
+                                input_schema.clone(),
                             ),
                         )))
                     }
                 } else {
                     Ok(Transformed::yes(LogicalPlan::Union(Union {
                         inputs: new_inputs,
-                        schema: union.schema.clone(),
+                        schema: input_schema.clone(),

Review Comment:
   Yes, I understand you.
   But for solution 1, like I said in 
https://github.com/apache/datafusion/pull/10494#discussion_r1600567694, the 
merged schema would use the `left_qualifier` in line 1395 - 1396, i.e. the 
first LogicalPlan's.
   ```
   left_qualifier.cloned(), 
   Arc::new(Field::new(left_field.name(), data_type, nullable)),
   ```
   However, I'm not quiet clear how to set the correct qualifier, they are 
different due to a `SubqueryAlias`🤔. Choosing either one would make some case 
failed. 😞 



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to