wiedld commented on code in PR #12142:
URL: https://github.com/apache/datafusion/pull/12142#discussion_r1730651101
##########
datafusion/expr/src/logical_plan/builder.rs:
##########
@@ -1331,7 +1331,17 @@ pub fn validate_unique_names<'a>(
})
}
-/// Union two logical plans.
+/// Union two [`LogicalPlan`]s.
+///
+/// Constructs the UNION plan, but does not perform type-coercion. Therefore
the
+/// subtree expressions will not be properly typed until the optimizer pass.
Review Comment:
Also, to clarify. The "incorrect plans" is because the new `union()`
behavior [takes the left node's
schema](https://github.com/apache/datafusion/blob/4fd460d7a2d2b60e6f9dc716148d8596d94d048c/datafusion/expr/src/logical_plan/builder.rs#L1346-L1352)
-- and doesn't type cast the expressions. When we built logical plans with
union + gap filling (adding casted scalar nulls), we started having missing
fields etc when inspecting the union before constructing the next node.
Maybe that part should be a bug?
--
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]