[ https://issues.apache.org/jira/browse/FLINK-31260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17698902#comment-17698902 ]
Aitozi commented on FLINK-31260: -------------------------------- [~zhengyiweng] Thanks for your attention, I think the exchange in rule pattern can be removed. I'd like revisit this issue after [https://github.com/apache/flink/pull/22001] merged. Since in that PR will generate the pattern above. > PushLocalHashAggIntoScanRule should also work with union RelNode > ---------------------------------------------------------------- > > Key: FLINK-31260 > URL: https://issues.apache.org/jira/browse/FLINK-31260 > Project: Flink > Issue Type: Improvement > Components: Table SQL / Planner > Reporter: Aitozi > Priority: Major > > 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)