godfreyhe commented on a change in pull request #9119: [FLINK-13268]
[table-planner-blink] Revert SqlSplittableAggFunction to support making two
planners available in one jar
URL: https://github.com/apache/flink/pull/9119#discussion_r303437254
##########
File path:
flink-table/flink-table-planner-blink/src/test/resources/org/apache/flink/table/plan/batch/sql/agg/AggregateReduceGroupingTest.xml
##########
@@ -116,14 +116,13 @@ LogicalAggregate(group=[{0, 1, 2, 3}],
EXPR$4=[COUNT($4)], EXPR$5=[AVG($5)])
</Resource>
<Resource name="planAfter">
<![CDATA[
-Calc(select=[a2, b2, a3, b3, *($f2, $f20) AS EXPR$4, /(CAST(CASE(=($f4, 0),
null:BIGINT, $f3)), $f4) AS EXPR$5])
-+- HashJoin(joinType=[InnerJoin], where=[=(b2, a3)], select=[a2, b2, $f2, a3,
b3, $f20, $f3, $f4], isBroadcast=[true], build=[right])
- :- Calc(select=[a2, b2, CAST(CASE(IS NOT NULL(c2), 1, 0)) AS $f2])
- : +- TableSourceScan(table=[[default_catalog, default_database, T2,
source: [TestTableSource(a2, b2, c2)]]], fields=[a2, b2, c2])
- +- Exchange(distribution=[broadcast])
- +- HashAggregate(isMerge=[true], groupBy=[a3, b3], select=[a3, b3,
Final_COUNT(count1$0) AS $f2, Final_$SUM0(sum$1) AS $f3, Final_COUNT(count$2)
AS $f4])
- +- Exchange(distribution=[hash[a3, b3]])
- +- LocalHashAggregate(groupBy=[a3, b3], select=[a3, b3,
Partial_COUNT(*) AS count1$0, Partial_$SUM0(d3) AS sum$1, Partial_COUNT(d3) AS
count$2])
+Calc(select=[a2, b2, a3, b3, EXPR$4, EXPR$5])
++- HashAggregate(isMerge=[true], groupBy=[a3, b3], auxGrouping=[a2, b2],
select=[a3, b3, a2, b2, Final_COUNT(count$0) AS EXPR$4, Final_AVG(sum$1,
count$2) AS EXPR$5])
Review comment:
the change reason is:
before this PR, the result after FlinkAggregateJoinTransposeRule is applied
is
```
LogicalProject(a2=[$0], b2=[$1], a3=[$3], b3=[$4], $f8=[*($2, $5)],
$f3=[$6], $f4=[$7])
LogicalJoin(condition=[=($1, $3)], joinType=[inner])
LogicalProject(a2=[$0], b2=[$1], $f2=[CAST(CASE(IS NOT NULL($2), 1,
0)):BIGINT NOT NULL])
LogicalTableScan(subset=[rel#251:Subset#0.NONE.any.[]],
table=[[default_catalog, default_database, T2, source: [TestTableSource(a2, b2,
c2)]]])
LogicalAggregate(group=[{0, 1}], agg#0=[COUNT()], agg#1=[SUM($2)],
agg#2=[COUNT($2)])
LogicalProject(subset=[rel#254:Subset#2.NONE.any.[]], a3=[$0],
b3=[$1], d3=[$3])
LogicalTableScan(subset=[rel#252:Subset#1.NONE.any.[]],
table=[[default_catalog, default_database, T3, source: [TestTableSource(a3, b3,
c3, d3)]]])
```
while, with this PR, the result after FlinkAggregateJoinTransposeRule is
applied is
```
LogicalProject(a2=[$0], b2=[$1], a3=[$3], b3=[$4], $f8=[*($2, $5)],
$f3=[$6], $f4=[$7])
LogicalJoin(condition=[=($1, $3)], joinType=[inner])
LogicalProject(a2=[$0], b2=[$1], $f2=[CASE(IS NOT NULL($2), 1:BIGINT,
0:BIGINT)])
LogicalTableScan(subset=[rel#251:Subset#0.NONE.any.[]],
table=[[default_catalog, default_database, T2, source: [TestTableSource(a2, b2,
c2)]]])
LogicalAggregate(group=[{0, 1}], agg#0=[COUNT()], agg#1=[SUM($2)],
agg#2=[COUNT($2)])
LogicalProject(subset=[rel#254:Subset#2.NONE.any.[]], a3=[$0],
b3=[$1], d3=[$3])
LogicalTableScan(subset=[rel#252:Subset#1.NONE.any.[]],
table=[[default_catalog, default_database, T3, source: [TestTableSource(a3, b3,
c3, d3)]]])
```
The difference is there is no `CAST` in second `LogicalProject` from the top
down. Because [CALCITE-896](https://issues.apache.org/jira/browse/CALCITE-896)
is fixed in Calcite-1.20. And the final effect is the cost of
`FlinkLogicalCalc` is changed (see: `CommonCalc#computeSelfCost`)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services