findepi opened a new issue, #14380: URL: https://github.com/apache/datafusion/issues/14380
### Is your feature request related to a problem or challenge? When building a query plan `union()` behavior doesn't type-coerce the expressions and it [takes the left node's schema](https://github.com/apache/datafusion/blob/4fd460d7a2d2b60e6f9dc716148d8596d94d048c/datafusion/expr/src/logical_plan/builder.rs#L1346-L1352). This creates an invalid plan which later needs to be fixed. It would be better to create a valid plan from the start. Note: https://github.com/apache/datafusion/pull/14356 moves the code around, but doesn't change the behavior. See https://github.com/apache/datafusion/pull/14356#discussion_r1936081492 ### Describe the solution you'd like Create correctly coerced plan if possible ### Describe alternatives you've considered Keep creating incorrect plan. Rely on some later logic to fix it some time later. ### Additional context - https://github.com/apache/datafusion/issues/14363 talks about similar problem, but for JOIN. It's better to be able to create a valid plan. -- 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: github-unsubscr...@datafusion.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org