comphead opened a new issue, #6385: URL: https://github.com/apache/arrow-datafusion/issues/6385
### Describe the bug Retested more complicated queries and found that behavior is not consistent depending on UNION arm having subqueries and aliases ### To Reproduce Wrong aliasing if if second arm has query alias ``` ❯ select count(*) count, n_regionkey from (select 5 as n_regionkey) a group by n_regionkey union all select x, y from (select 1 as x , max(10) as y) b; +---+----+ | x | y | +---+----+ | 1 | 10 | | 1 | 5 | +---+----+ ``` Without query alias it works fine ``` ❯ select count(*) count, n_regionkey from (select 5 as n_regionkey) group by n_regionkey union all select x, y from (select 1 as x , max(10) as y); +-------+-------------+ | count | n_regionkey | +-------+-------------+ | 1 | 10 | | 1 | 5 | +-------+-------------+ ``` ### Expected behavior Should work correctly ### Additional context Part of https://github.com/apache/arrow-datafusion/issues/5695#issuecomment-1483550835 -- 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]
