godfreyhe commented on a change in pull request #11674: [FLINK-16887][table-planner-blink] Refactor retraction rules to support inferring ChangelogMode URL: https://github.com/apache/flink/pull/11674#discussion_r407196427
########## File path: flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/nodes/physical/stream/StreamExecGroupAggregate.scala ########## @@ -64,7 +63,14 @@ class StreamExecGroupAggregate( with StreamExecNode[BaseRow] { val aggInfoList: AggregateInfoList = { - val needRetraction = StreamExecRetractionRules.isAccRetract(getInput) + // need to call `retract()` if input contains update or delete + val modifyKindSetTrait = inputRel.getTraitSet.getTrait(ModifyKindSetTraitDef.INSTANCE) + val needRetraction = if (modifyKindSetTrait == null) { + // FlinkChangelogModeInferenceProgram is not applied yet, false as default + false + } else { + !modifyKindSetTrait.modifyKindSet.isInsertOnly + } Review comment: extract these code as a method, and put it in `AggregateUtil`, both `StreamExecGroupAggregate` and `StreamExecGroupTableAggregate` can use it ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services