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

Moved BucketsAggregator#docCounts field to IntArray #6529

Merged

Conversation

martijnvg
Copy link
Member

No description provided.

return asc ? Long.compare(v1, v2) : Long.compare(v2, v1);
int v1 = ((SingleBucketAggregator) aggregator).bucketDocCount(((InternalTerms.Bucket) o1).bucketOrd);
int v2 = ((SingleBucketAggregator) aggregator).bucketDocCount(((InternalTerms.Bucket) o2).bucketOrd);
return asc ? Integer.compare(v1, v2) : Integer.compare(v2, v1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Since counts are positive, I think you can make it faster by computing int mul = asc ? 1 : -1 up-front and returning mul * (v1 - v2) in compare?

Copy link
Member Author

Choose a reason for hiding this comment

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

Make sense, I'll change

@jpountz
Copy link
Contributor

jpountz commented Jun 17, 2014

LGTM
Thanks @martijnvg for taking care of this!

… because a shard can't hold more than Integer.MAX_VALUE a LongArray just takes unnecessary space.

Closes elastic#6529
martijnvg added a commit that referenced this pull request Jun 17, 2014
… because a shard can't hold more than Integer.MAX_VALUE a LongArray just takes unnecessary space.

Closes #6529
@martijnvg martijnvg merged commit cb9548f into elastic:master Jun 17, 2014
@spinscale spinscale changed the title Moved BucketsAggregator#docCounts field to IntArray Aggregations: Moved BucketsAggregator#docCounts field to IntArray Jun 18, 2014
@martijnvg martijnvg removed the bug label Jul 1, 2014
@martijnvg martijnvg deleted the improvements/aggs_doc_counts_to_int_array branch May 18, 2015 23:31
@clintongormley clintongormley changed the title Aggregations: Moved BucketsAggregator#docCounts field to IntArray Moved BucketsAggregator#docCounts field to IntArray Jun 7, 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.

None yet

3 participants