added cumulative sum reducer function for terms aggregations and added tests for cumulative sum aggregator #46225#95199
Closed
timothy-choi wants to merge 0 commit intoelastic:mainfrom
Closed
added cumulative sum reducer function for terms aggregations and added tests for cumulative sum aggregator #46225#95199timothy-choi wants to merge 0 commit intoelastic:mainfrom
timothy-choi wants to merge 0 commit intoelastic:mainfrom
Conversation
|
assigning the ticket to the right team |
Collaborator
|
Pinging @elastic/es-search (Team:Search) |
Collaborator
|
Pinging @elastic/es-analytics-geo (Team:Analytics) |
Member
|
Moving to the Analytics team since this PR adds a new pipeline aggregation. |
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.
Here is my attempt to add a cumulative sum aggregation to a bucket that is a terms aggregation for issue #46225. I created another reducer function called 'reducerTermsAgg' that retrieves all the buckets of a terms aggregation and iterates through each bucket to calculate the sum of all the entries in the bucket and saving them in a map. I also created a helper function that takes that map and creates an aggregation that contains all sums of each bucket for each value type. The value types I used where Double, Long, and String.
I also added unit tests for this implementation. These tests cover whether the cumulative sum aggregation works on String, Double, and Long types, as well whether it works with no buckets provided and if it can also correctly find the total _count of each bucket.