universalmind303 opened a new issue, #7481:
URL: https://github.com/apache/arrow-datafusion/issues/7481
### Is your feature request related to a problem or challenge?
if your query contains many nested unions, it could result in an inefficient
plan. If it is a union of unions, we can easily simplify that to a single union
node.
### Describe the solution you'd like
nested union nodes should be rewritten as a single union node
```mermaid
flowchart TD
A[union] --> B[4]
A --> C[union]
C --> D[2]
C --> E[1]
```
```mermaid
flowchart TD
A[union] --> B[4]
A --> D[2]
A --> E[1]
```
### Describe alternatives you've considered
None come to mind.
### Additional context
For reference, polars optimizes these away.
https://github.com/pola-rs/polars/issues/7855
https://github.com/pola-rs/polars/pull/7861
--
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]