JunRuiLee commented on code in PR #21672:
URL: https://github.com/apache/flink/pull/21672#discussion_r1089959497
##########
flink-table/flink-table-planner/src/test/resources/org/apache/flink/table/planner/plan/batch/sql/agg/OverAggregateTest.xml:
##########
@@ -71,17 +75,21 @@ LogicalProject(EXPR$0=[CASE(>(COUNT($0) OVER (PARTITION BY
$1 ORDER BY $2 NULLS
<![CDATA[
Calc(select=[CASE((w0$o0 > 0), w0$o1, null:INTEGER) AS EXPR$0, w1$o0 AS
EXPR$1, w2$o0 AS EXPR$2, w0$o2 AS EXPR$3, CAST((CASE((w3$o0 > 0), w3$o1,
null:INTEGER) / w3$o0) AS INTEGER) AS EXPR$4])
+- OverAggregate(partitionBy=[c], orderBy=[a ASC], window#0=[MAX(a) AS w0$o0
RANG BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW], select=[a, b, c, w0$o2,
w1$o0, w0$o1, w3$o0, w3$o1, w2$o0, w0$o0])
- +- Sort(orderBy=[c ASC, a ASC])
- +- Exchange(distribution=[hash[c]])
- +- OverAggregate(partitionBy=[b], orderBy=[c ASC], window#0=[COUNT(a)
AS w3$o0, $SUM0(a) AS w3$o1 RANG BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW],
window#1=[RANK(*) AS w2$o0 RANG BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW],
select=[a, b, c, w0$o2, w1$o0, w0$o1, w3$o0, w3$o1, w2$o0])
- +- Sort(orderBy=[b ASC, c ASC])
- +- Exchange(distribution=[hash[b]])
- +- OverAggregate(orderBy=[c ASC, a ASC], window#0=[MIN(a) AS
w0$o1 RANG BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW], select=[a, b, c,
w0$o2, w1$o0, w0$o1])
- +- Sort(orderBy=[c ASC, a ASC])
- +- OverAggregate(orderBy=[b ASC], window#0=[COUNT(a)
AS w0$o2, $SUM0(a) AS w1$o0 RANG BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW],
select=[a, b, c, w0$o2, w1$o0])
- +- Sort(orderBy=[b ASC])
- +- Exchange(distribution=[single])
- +-
LegacyTableSourceScan(table=[[default_catalog, default_database, MyTable,
source: [TestTableSource(a, b, c)]]], fields=[a, b, c])
+ +- Exchange(distribution=[forward])
+ +- Sort(orderBy=[c ASC, a ASC])
+ +- Exchange(distribution=[hash[c]])
+ +- OverAggregate(partitionBy=[b], orderBy=[c ASC],
window#0=[COUNT(a) AS w3$o0, $SUM0(a) AS w3$o1 RANG BETWEEN UNBOUNDED PRECEDING
AND CURRENT ROW], window#1=[RANK(*) AS w2$o0 RANG BETWEEN UNBOUNDED PRECEDING
AND CURRENT ROW], select=[a, b, c, w0$o2, w1$o0, w0$o1, w3$o0, w3$o1, w2$o0])
+ +- Exchange(distribution=[forward])
+ +- Sort(orderBy=[b ASC, c ASC])
+ +- Exchange(distribution=[hash[b]])
+ +- OverAggregate(orderBy=[c ASC, a ASC],
window#0=[MIN(a) AS w0$o1 RANG BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW],
select=[a, b, c, w0$o2, w1$o0, w0$o1])
+ +- Exchange(distribution=[forward])
+ +- Sort(orderBy=[c ASC, a ASC])
+ +- Exchange(distribution=[forward])
+ +- OverAggregate(orderBy=[b ASC],
window#0=[COUNT(a) AS w0$o2, $SUM0(a) AS w1$o0 RANG BETWEEN UNBOUNDED PRECEDING
AND CURRENT ROW], select=[a, b, c, w0$o2, w1$o0])
+ +- Sort(orderBy=[b ASC])
Review Comment:
The plan is generated according to UT case. If add `Exchange
(distribution=[forward])` between Sort and OverAggregate, the
OverAggregateTest#testDiffPartitionKeysWithDiffOrderKeys2 will failed
--
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]