Skip to content

Refactor: Aggs use NOOP leaf collector (backport of #70320) #70419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 15, 2021

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Mar 15, 2021

Before this commit, if an aggregator didn't have anything to do in
AggregatorBase#getLeafCollector it was obligated to throw
CollectionTerminatedException if there wasn't a parent aggregator,
otherwise it was obligated to return LeafBucketCollector.NOOP. This
seems like something aggregators shouldn't have to do. So this commit
changes getLeafCollector so aggregators are obligated to return
LeafBucketCollector.NOOP if they have no work to do. The aggregation
framework will throw the exception if its appropriate. Otherwise it'll
use the NOOP collector. If they have work to do the
LeafBucketCollectors that they do return may still throw
CollectionTerminatedException to signal that they are done with the
leaf.

Before this commit, if an aggregator didn't have anything to do in
`AggregatorBase#getLeafCollector` it was obligated to throw
`CollectionTerminatedException` if there wasn't a parent aggregator,
otherwise it was obligated to return `LeafBucketCollector.NOOP`. This
seems like something aggregators shouldn't have to do. So this commit
changes `getLeafCollector` so aggregators are obligated to return
`LeafBucketCollector.NOOP` if they have no work to do. The aggregation
framework will throw the exception if its appropriate. Otherwise it'll
use the `NOOP` collector. If they have work to do the
`LeafBucketCollector`s that they do return may still throw
`CollectionTerminatedException` to signal that they are done with the
leaf.
@nik9000
Copy link
Member Author

nik9000 commented Mar 15, 2021

@elasticmachine, test this please

@nik9000 nik9000 merged commit 0a31d51 into elastic:7.x Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant