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

Align behavior HDR percentiles iterator with percentile() method #24206

merged 1 commit into from Apr 20, 2017


None yet
3 participants

tlrx commented Apr 20, 2017

This pull request aligns the percentiles values returned by the iterator() method with what is returned by the percentile(double percent) method in the InternalHDRPercentile class.

The InternalHDRPercentile.percentile(double percent) has some logic when no values have been recorded in the DoubleHistogram state:

public double percentile(double percent) {
         if (state.getTotalCount() == 0) {
             return Double.NaN;
         return state.getValueAtPercentile(percent);

but when a Percentile object it instantiated in the next() method of the iterator it does not use the same logic:

 final Percentile next = new Percentile(percents[i], state.getValueAtPercentile(percents[i]));

So the value returned by hdr.percentile(0.99) can be Double.NaN but when accessed using the iterator returns the value returned for the same percentile is 0.



@tlrx tlrx merged commit 55a879e into elastic:master Apr 20, 2017

2 checks passed

CLA Commit author is a member of Elasticsearch
elasticsearch-ci Build finished.

This comment has been minimized.


tlrx commented Apr 20, 2017

Thanks @colings86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment