mslapek commented on PR #5745: URL: https://github.com/apache/arrow-datafusion/pull/5745#issuecomment-1486282656
@mingmwang You gave a great idea - it should be **a physical plan
optimization!** 💡
The optimization should push down partial aggregate though union:
```
...
| logical_plan | Aggregate:
groupBy=[[]], aggr=[[COUNT(UInt8(1))]]
|
| | Union
|
| |
TableScan: my_table projection=[c1]
|
| |
Projection: my_table2.c1 AS my_table.c1
|
| |
TableScan: my_table2 projection=[c1]
...
| physical_plan |
AggregateExec: mode=Final, gby=[], aggr=[COUNT(UInt8(1))]
|
| |
CoalescePartitionsExec
|
|
| |
RepartitionExec: partitioning=RoundRobinBatch(10), input_partitions=2
|
| |
UnionExec
| |
AggregateExec: mode=Partial, gby=[], aggr=[COUNT(UInt8(1))]
|
| |
CsvExec: files={1 group:
[[/home/hello/repo/arrow-datafusion/datafusion/core/tests/data/aggregate_simple.csv]]},
has_header=true, limit=None, projection=[c1] |
| |
AggregateExec: mode=Partial, gby=[], aggr=[COUNT(UInt8(1))]
| |
ProjectionExec: expr=[c1@0 as my_table.c1]
|
| |
CsvExec: files={1 group:
[[/home/hello/repo/arrow-datafusion/datafusion/core/tests/data/aggregate_simple2.csv]]},
has_header=true, limit=None, projection=[c1] |
| |
|
+------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
```
Optimization in the logical plan gave unnecessary doubled final-partial
aggregate pair.
@mingmwang What do you think?
--
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]
