godfreyhe commented on a change in pull request #9056: [FLINK-13185] 
[sql-parser][table-planner] Bump Calcite dependency to 1.20.0 in sql parser & 
flink planner
URL: https://github.com/apache/flink/pull/9056#discussion_r302031379
 
 

 ##########
 File path: 
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/runtime/stream/table/RetractionITCase.scala
 ##########
 @@ -110,7 +110,7 @@ class RetractionITCase extends StreamingWithStateTestBase {
       .select('count, 'count.count)
 
     val results = resultTable.toRetractStream[Row]
-    results.addSink(new StreamITCase.RetractingSink)
+    results.addSink(new StreamITCase.RetractingSink).setParallelism(1)
 
 Review comment:
   the original flink logical plan is:
   `
   FlinkLogicalAggregate(group=[{0}], EXPR$0=[COUNT($0)])
     FlinkLogicalAggregate(group=[{}], EXPR$0=[SUM($0)])
       FlinkLogicalCalc(expr#0..1=[{inputs}], num=[$t1])
         FlinkLogicalDataStreamScan(id=[1], fields=[word, num])
   `
   
   after upgrade to calcite 1.20.0, the new flink logical plan is 
   `
   FlinkLogicalCalc(expr#0=[{inputs}], expr#1=[IS NOT NULL($t0)], 
expr#2=[1:BIGINT], expr#3=[0:BIGINT], expr#4=[CASE($t1, $t2, $t3)], 
count=[$t0], $f1=[$t4])
     FlinkLogicalAggregate(group=[{}], EXPR$0=[SUM($0)])
       FlinkLogicalCalc(expr#0..1=[{inputs}], num=[$t1])
         FlinkLogicalDataStreamScan(id=[1], fields=[word, num])
   `
   the change is cause by 
[CALCITE-896](http://issues.apache.org/jira/browse/CALCITE-896) in 1.20.0.
   
   the physical plan is
   `
   DataStreamCalc(select=[EXPR$0 AS count, CASE(IS NOT NULL(EXPR$0), 1:BIGINT, 
0:BIGINT) AS $f1])
     DataStreamGroupAggregate(select=[SUM(num) AS EXPR$0])
       DataStreamCalc(select=[num])
         DataStreamScan(id=[1], fields=[word, num])
   `
   
   the parallelism of transformations corresponding to the top `DataStreamCalc` 
and `DataStreamGroupAggregate` is 1, while the parallelism of sink 
transformation is 4 (default value), so we should set the parallelism of sink 
as 1 to avoid shuffling data.

----------------------------------------------------------------
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

Reply via email to