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 max-int limit for number of points reduced in geo_centroid #56370
Conversation
A bug in InternalGeoCentroid#reduce existed that summed up the aggregation's long-valued counts into a local integer variable. Since it is definitely possible to reduce more than Integer.MAX points, this change simply updates that variable to be a long-valued number. Closes elastic#55992.
Pinging @elastic/es-analytics-geo (:Analytics/Geo) |
@@ -115,7 +115,7 @@ public long count() { | |||
public InternalGeoCentroid reduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) { | |||
double lonSum = Double.NaN; | |||
double latSum = Double.NaN; | |||
int totalCount = 0; | |||
long totalCount = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh! The count
member variable was always a long!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh!
...er/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalGeoCentroidTests.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much ❤️
thanks Nik! |
A bug in InternalGeoCentroid#reduce existed that summed up the aggregation's long-valued counts into a local integer variable. Since it is definitely possible to reduce more than Integer.MAX points, this change simply updates that variable to be a long-valued number. Closes #55992.
A bug in InternalGeoCentroid#reduce existed that summed up the aggregation's long-valued counts into a local integer variable. Since it is definitely possible to reduce more than Integer.MAX points, this change simply updates that variable to be a long-valued number. Closes #55992.
A bug in InternalGeoCentroid#reduce existed that summed up
the aggregation's long-valued counts into a local integer variable.
Since it is definitely possible to reduce more than Integer.MAX points,
this change simply updates that variable to be a long-valued number.
Closes #55992.