beyond1920 commented on a change in pull request #16219:
URL: https://github.com/apache/flink/pull/16219#discussion_r661248071



##########
File path: 
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/operators/window/TableAggregateWindowOperator.java
##########
@@ -124,6 +128,9 @@ protected void compileGeneratedCode() {
     @Override
     protected void emitWindowResult(W window) throws Exception {
         windowFunction.prepareAggregateAccumulatorForEmit(window);
-        tableAggWindowAggregator.emitValue(window, (RowData) getCurrentKey(), 
collector);
+        RowData acc = tableAggWindowAggregator.getAccumulators();
+        if (!recordCounter.recordCountIsZero(acc)) {

Review comment:
       already covered by exisited 
`WindowOperatorContractTest#testAssignerWithMultipleWindowsForTableAggregate`.
   If i didn't update `mockTableAggsHandleFunction`, it would return 
accumulator to null.
   

##########
File path: 
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/operators/window/AggregateWindowOperator.java
##########
@@ -156,35 +160,55 @@ protected void compileGeneratedCode() {
     @Override
     protected void emitWindowResult(W window) throws Exception {
         windowFunction.prepareAggregateAccumulatorForEmit(window);
+        RowData acc = aggWindowAggregator.getAccumulators();
         RowData aggResult = aggWindowAggregator.getValue(window);
         if (produceUpdates) {

Review comment:
       1.`produceUpdate` is true and count decreases to 0 could be covered by 
new added `GroupWindowITCase#testWindowAggregateOnUpsertSourceWithAllowLateness`
   2. `produceUpdate` is true and count always not 0 could be covered by 
existed `GroupWindowITCase#testMinMaxWithTumblingWindow`
   3. `produceUpdate` is false could be covered by many existed 
`GroupWindowITCase#testWindowAggregateOnUpsertSource`
   
   
   

##########
File path: 
flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/planner/runtime/stream/sql/GroupWindowITCase.scala
##########
@@ -412,10 +412,8 @@ class GroupWindowITCase(mode: StateBackendMode, 
useTimestampLtz: Boolean)
     tEnv.sqlQuery(sql).toAppendStream[Row].addSink(sink)

Review comment:
       done




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


Reply via email to