[FLINK-35661][table] Fix MiniBatchGroupAggFunction silently dropping records (backport 2.1) #27573
+154
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
Backport of #27505 to
release-2.1.This fixes a bug in
MiniBatchGroupAggFunction.finishBundle()where records were being silently dropped when a mini-batch bundle contained a key with only retraction messages and no existing accumulator state.The root cause was using
returninstead ofcontinuewheninputRowsbecame empty after filtering out leading retraction messages for a key with no state. This caused the method to exit entirely, abandoning processing of all remaining keys in the bundle.Brief change log
return;tocontinue;inMiniBatchGroupAggFunction.finishBundle()so processing continues to the next key instead of exiting the entire methodMiniBatchGroupAggFunctionTestthat directly verifies the fixVerifying this change
This change added tests and can be verified as follows:
MiniBatchGroupAggFunctionTest.testFinishBundleContinuesAfterEmptyInputRows()which creates a mock bundle with three keys where the first key has only a DELETE message (no existing state). The test verifies that keys after the first are still processed correctly.