Open
Description
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.
This creates an invalid plan which later needs to be fixed. It would be better to create a valid plan from the start.
Note: #14356 moves the code around, but doesn't change the behavior. See @alamb's #14356 (comment)
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
- see @wiedld's Provide documentation of expose APIs to enable handling of type coercion at UNION plan construction. #12142 (comment)
- see @alamb's Core: Fix UNION field nullability tracking #14356 (comment)
- Add
try_new
forLogicalPlan::Join
Join
and others #14363 talks about similar problem, but for JOIN. It's better to be able to create a valid plan.