-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Add min support to exponential histograms #133639
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
Conversation
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
...ram/src/test/java/org/elasticsearch/exponentialhistogram/ExponentialHistogramUtilsTests.java
Show resolved
Hide resolved
histo.tryAddBucket(2, 6, false); | ||
assertThat(toJson(histo), equalTo("{\"scale\":5,\"sum\":1.1,\"negative\":{\"indices\":[-1,2],\"counts\":[4,6]}}")); | ||
assertThat(toJson(histo), equalTo("{\"scale\":5,\"sum\":1.1,\"min\":-0.5,\"negative\":{\"indices\":[-1,2],\"counts\":[4,6]}}")); | ||
} |
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.
Do we have an example here where sum and min are calculated from the histogram buckets?
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.
No, this tests are only about serialization and don't care about semantic correctness.
For the correctness of aggregates we have tests in ExponentialHistogramMergerTests.java.
valueCount = valueCounts.longValue(); | ||
valueSum = NumericUtils.sortableLongToDouble(valueSums.longValue()); | ||
|
||
if (valueMins != null && valueMins.advanceExact(docId)) { |
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.
Can we have sum but not min?
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.
Yes, for empty histograms: sum is 0.0, but min is not available.
Very similar to #133381 , but adds support for tracking the exact minimum for exponential histograms:
null