Module org.elasticsearch.xcore
Class ExponentialHistogramToTDigestConverter
java.lang.Object
org.elasticsearch.xpack.core.analytics.mapper.ExponentialHistogramToTDigestConverter
Utility class for converting
ExponentialHistogram instances to t-digests represented as EncodedTDigest.CentroidIterator.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvert(org.elasticsearch.exponentialhistogram.ExponentialHistogram.Buckets negativeBuckets, org.elasticsearch.exponentialhistogram.ZeroBucket zeroBucket, org.elasticsearch.exponentialhistogram.ExponentialHistogram.Buckets positiveBuckets) Converts exponential histograms to t-digests.
-
Constructor Details
-
ExponentialHistogramToTDigestConverter
public ExponentialHistogramToTDigestConverter()
-
-
Method Details
-
convert
public static EncodedTDigest.CentroidIterator convert(org.elasticsearch.exponentialhistogram.ExponentialHistogram.Buckets negativeBuckets, org.elasticsearch.exponentialhistogram.ZeroBucket zeroBucket, org.elasticsearch.exponentialhistogram.ExponentialHistogram.Buckets positiveBuckets) Converts exponential histograms to t-digests. This algorithm computes the arithmetic bucket centers (midpoint between lower and upper bounds) and uses them as centroids for the resulting T-Digest.
Note that the conversion is partially lazy, so theBucketIterators must remain valid until the returnEncodedTDigest.CentroidIteratoris fully consumed. The implementation will be fully lazy if either- The histogram to convert does not have negative buckets
- The implementation of the histogram supports a copy-free
ExponentialHistogram.Buckets.reverseIterator()
- Parameters:
negativeBuckets- the negative buckets of the exponential histogramzeroBucket- the zero bucket of the exponential histogrampositiveBuckets- the positive buckets of the exponential histogram- Returns:
- the resulting t-digest histogram
-