Fix aggregate processor actions concludeGroup#6147
Merged
Conversation
Signed-off-by: Kondaka <krishkdk@amazon.com>
Signed-off-by: Kondaka <krishkdk@amazon.com>
dlvenable
reviewed
Oct 8, 2025
|
|
||
| final List<Event> concludeGroupEvents = actionOutput != null ? actionOutput.getEvents() : null; | ||
| if (!concludeGroupEvents.isEmpty()) { | ||
| if (concludeGroupEvents != null && !concludeGroupEvents.isEmpty()) { |
Member
There was a problem hiding this comment.
Add a unit test for this new condition.
Collaborator
Author
There was a problem hiding this comment.
I have added a test for the new condition in AggregateProecssorIT.java. Not sure if unit test really makes any difference.
| } | ||
|
|
||
| @Test | ||
| void concludeGroup_with_empty_groupState_handled_correctly() throws NoSuchFieldException, IllegalAccessException { |
Member
There was a problem hiding this comment.
concludeGroup_with_empty_groupState_returns_null
| } | ||
|
|
||
| @Test | ||
| void testHistogramAggregationWithEmptyGroupState() throws NoSuchFieldException, IllegalAccessException { |
Member
There was a problem hiding this comment.
testHistogramAggregationWithEmptyGroupStateReturnsNull
| } | ||
|
|
||
| @Test | ||
| void testCountAggregationWithEmptyGroupState() { |
Member
There was a problem hiding this comment.
testCountAggregationWithEmptyGroupStateReturnsNull
Signed-off-by: Kondaka <krishkdk@amazon.com>
dlvenable
approved these changes
Oct 8, 2025
graytaylor0
reviewed
Oct 8, 2025
| public AggregateActionOutput concludeGroup(final AggregateActionInput aggregateActionInput) { | ||
| GroupState groupState = aggregateActionInput.getGroupState(); | ||
| if (groupState.isEmpty()) { | ||
| return null; |
Member
There was a problem hiding this comment.
Are we sure we should return null here? Why not return the output with empty list?
Collaborator
Author
There was a problem hiding this comment.
Both are treated the same way. So, it really doesn't matter.
graytaylor0
approved these changes
Oct 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fix aggregate processor actions concludeGroup. concludeGroup should handle groupState being empty.
If identification keys contain null values, then
handleEventof aggregate processor actions do not update the groupState and if such group is concluded, it can result in concludeGroup to throw exceptions. If the groupState is empty, it is better to return null AggregateActionOutput.Issues Resolved
Resolves #[Issue number to be closed when this PR is merged]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.