galaxytemple commented on code in PR #27347:
URL: https://github.com/apache/datafusion/pull/27347#discussion_r4556401225


##########
datafusion/physical-expr/src/equivalence/properties/union.rs:
##########


Review Comment:
   Thanks for the question @vinycalves!
   1. Aliases: `calculate_union` normalizes columns using their position index 
(col.index()) via `with_new_schema`. So even if different arms use different 
aliases, they get mapped to the same union output columns.
   2. Casts: `UnionExec` requires all inputs to have matching data types. 
Before this function, `TypeCoercion` already aligns them by inserting necessary 
casts (e.g. casting Int to BigInt).
   I've also added a test case in `union.slt` verifying that union inputs with 
mismatched aliases and casts.



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