Skip to content

Conversation

@ericjster
Copy link

What does this PR do?

A brief description of the change being made with this pull request.

Have GetValueAtQuantile return min and max for quantiles 0 and 100.
DDSketchWithExactSummaryStatistics already store the min and max values and clamp the values within that range.
But we can still have quantile 100 return values less than the max.
This change ensures that quantile 0 returns min, and quantile 100 returns max.

Motivation

What inspired you to submit this pull request?
I am working on using DDSketch to report some stats, and found for integer inputs DDSketch would return non-integer values. For example the data set { 28 } (one value) returns p100 of 27.5. I pursued changing the relativeAccuracy parameter, then realized fixing p100 to return GetMax seemed beneficial for all users.

Additional Notes

Anything else we should know when reviewing?

FWIW, one might want to investigate by keeping the new test lines in ddsketch_test.go and temporarily reverting the changes in ddsketch.go. I found testing easier by only running TestNormal, and limiting testSizes={3} and testQuantiles = []float64{0, 1}, and testCases = []testCase... to only the first one with exactSummaryStatistics: true.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants