comphead opened a new issue, #6139:
URL: https://github.com/apache/arrow-datafusion/issues/6139
### Describe the bug
UNION ALL sets the wrong column alias if union arm has aggregate expression,
see query below.
### To Reproduce
```
#[tokio::test]
async fn union_with_aggr_first() -> Result<()> {
let ctx = create_union_context()?;
let sql = "select count(1) x from (select 1 a) group by a union all
select 1 b;";
let df =
ctx.sql(sql).await.unwrap().repartition(Partitioning::RoundRobinBatch(1)).unwrap();
let actual = df.collect().await.unwrap();
let expected = vec![
"+---+",
"| x |",
"+---+",
"| 1 |",
"| 1 |",
"+---+",
];
assert_batches_eq!(expected, &actual);
Ok(())
}
```
Without group by the query works fine
```select count(1) x from (select 1 a) a union all select 1 b;```
### Expected behavior
The test should pass
### Additional context
_No response_
--
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]