Aitozi created FLINK-31260: ------------------------------ Summary: PushLocalHashAggIntoScanRule should also work with union RelNode Key: FLINK-31260 URL: https://issues.apache.org/jira/browse/FLINK-31260 Project: Flink Issue Type: Improvement Reporter: Aitozi
As discussed in [comments|https://github.com/apache/flink/pull/22001#discussion_r1119652784] Currently, {{PushLocalHashAggIntoScanRule}} match for the Exchange -> LocalHashAggregate -> Scan. As a result, the following pattern can not be optimized {code:java} +- Union(all=[true], union=[type, sum$0]) :- Union(all=[true], union=[type, sum$0]) : :- LocalHashAggregate(groupBy=[type], select=[type, Partial_SUM(price) AS sum$0]) : : +- TableSourceScan(table=[[default_catalog, default_database, table1, project=[type, price], metadata=[]]], fields=[type, price]) : +- LocalHashAggregate(groupBy=[type], select=[type, Partial_SUM(price) AS sum$0]) : +- TableSourceScan(table=[[default_catalog, default_database, table2, project=[type, price], metadata=[]]], fields=[type, price]) +- LocalHashAggregate(groupBy=[type], select=[type, Partial_SUM(price) AS sum$0]) +- TableSourceScan(table=[[default_catalog, default_database, table3, project=[type, price], metadata=[]]], fields=[type, price]) {code} We should extend the rule to support this pattern. -- This message was sent by Atlassian Jira (v8.20.10#820010)