Skip to content

Conversation

@iverase
Copy link
Contributor

@iverase iverase commented Sep 17, 2020

Currently we always call reduce even when we only have one InternalAggregation. In some cases this is necessary but in others the reduce method is just making a copy of itself. This is normally not too expensive excepts for aggregations that hold expensive objects, for example cardinality or percentile aggregations.

In order to prevent this necessary step this PR adds a new abstract method in InternalAggregation that flags the framework if it needs to reduce on a single InternalAggregation.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (:Analytics/Aggregations)

@elasticmachine elasticmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Sep 17, 2020
@iverase
Copy link
Contributor Author

iverase commented Sep 17, 2020

@elasticmachine run elasticsearch-ci/packaging-sample-windows

@iverase
Copy link
Contributor Author

iverase commented Sep 17, 2020

I am actually wondering if reduce on a single egg should take into account context.isFinalReduce() ?

Nope, it break tests

Copy link
Member

@nik9000 nik9000 left a comment

Choose a reason for hiding this comment

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

Sure! It is a shame to have another method to remember to deal with but it looks like mostly the default implementation is correct.

@nik9000
Copy link
Member

nik9000 commented Sep 17, 2020

mostly the default implementation is correct.

I mean that most new aggs can just accept the default implementation.

@iverase iverase merged commit 6344a97 into elastic:master Sep 18, 2020
@iverase iverase deleted the mustReduceOnSingleInternalAgg branch September 18, 2020 05:47
iverase added a commit that referenced this pull request Sep 18, 2020
…#62594)

Adds a new abstract method in InternalAggregation that flags the framework if it needs to reduce on a single InternalAggregation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/Aggregations Aggregations >enhancement Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v7.10.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants