Class ExponentialHistogramToTDigestConverter

java.lang.Object
org.elasticsearch.xpack.core.analytics.mapper.ExponentialHistogramToTDigestConverter

public class ExponentialHistogramToTDigestConverter extends Object
Utility class for converting ExponentialHistogram instances to t-digests represented as EncodedTDigest.CentroidIterator.
  • 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 the BucketIterators must remain valid until the return EncodedTDigest.CentroidIterator is 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 histogram
      zeroBucket - the zero bucket of the exponential histogram
      positiveBuckets - the positive buckets of the exponential histogram
      Returns:
      the resulting t-digest histogram