[ https://issues.apache.org/jira/browse/FLINK-31260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17698847#comment-17698847 ]
ZhengYi Weng commented on FLINK-31260: -------------------------------------- Hi,[~aitozi] .I think that the exchange in the rules may can be removed.I tried to remove it and had passed theĀ PushLocalAggIntoTableSourceScanRuleTest andĀ LocalAggregatePushDownITCase. But I'm not sure if it will affect others and result to incorrect results.WDYT? > 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)