Skip to content
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

Fix multi-level breadth-first aggregations. #10411

Merged
merged 1 commit into from Apr 9, 2015

Conversation

jpountz
Copy link
Contributor

@jpountz jpountz commented Apr 3, 2015

The refactoring in #9544 introduced a regression that broke multi-level
aggregations using breadth-first. This was due to sub-aggregators creating
deferred collectors before their parent aggregator and then the parent
aggregator trying to collect sub aggregators directly instead of going through
the deferred wrapper.

This commit fixes the issue but we should try to simplify all the pre/post
collection logic that we have.

Also breadth_first is now automatically ignored if the sub aggregators need
scores (just like we ignore execution_mode when the value does not make sense
like using ordinals on a script).

Close #9823

@jpountz
Copy link
Contributor Author

jpountz commented Apr 8, 2015

@colings86 Would you mind reviewing this change?

}
context.aggregations().aggregators(aggregators);
final BucketCollector collector = BucketCollector.wrap(collectors);
collector.preCollection();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the these two lines not be put inside of the if statement so we don't create the wrapper unless we are going to use it?

@colings86
Copy link
Contributor

@jpountz left some comments

@jpountz
Copy link
Contributor Author

jpountz commented Apr 8, 2015

@colings86 Pushed a new commit

@colings86
Copy link
Contributor

LGTM

@jpountz jpountz force-pushed the fix/multi_level_breadth_first branch from 9af63f4 to 978724f Compare April 9, 2015 10:05
The refactoring in elastic#9544 introduced a regression that broke multi-level
aggregations using breadth-first. This was due to sub-aggregators creating
deferred collectors before their parent aggregator and then the parent
aggregator trying to collect sub aggregators directly instead of going through
the deferred wrapper.

This commit fixes the issue but we should try to simplify all the pre/post
collection logic that we have.

Also `breadth_first` is now automatically ignored if the sub aggregators need
scores (just like we ignore `execution_mode` when the value does not make sense
like using ordinals on a script).

Close elastic#9823
@jpountz jpountz force-pushed the fix/multi_level_breadth_first branch from 978724f to 6b16b32 Compare April 9, 2015 10:06
jpountz added a commit that referenced this pull request Apr 9, 2015
Aggregations: Fix multi-level breadth-first aggregations.

Close #10411
@jpountz jpountz merged commit 2a844fc into elastic:master Apr 9, 2015
@jpountz jpountz deleted the fix/multi_level_breadth_first branch April 9, 2015 10:09
@clintongormley clintongormley changed the title Aggregations: Fix multi-level breadth-first aggregations. Fix multi-level breadth-first aggregations. Jun 8, 2015
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.

Aggs: breadth_first does not work on several levels
3 participants