java.lang.Object
org.elasticsearch.search.aggregations.metrics.TDigestState
Direct Known Subclasses:
EmptyTDigestState

public class TDigestState extends Object
Decorates TDigest with custom serialization. The underlying implementation for TDigest is selected through factory method params, providing one optimized for performance (e.g. MergingDigest or HybridDigest) by default, or optionally one that produces highly accurate results regardless of input size but its construction over the sample population takes 2x-10x longer.
  • Constructor Details

  • Method Details

    • create

      public static TDigestState create(double compression)
      Default factory for TDigestState. The underlying TDigest implementation is optimized for performance, potentially providing slightly inaccurate results compared to other, substantially slower implementations.
      Parameters:
      compression - the compression factor for the underlying TDigest object
      Returns:
      a TDigestState object that's optimized for performance
    • createOptimizedForAccuracy

      public static TDigestState createOptimizedForAccuracy(double compression)
      Factory for TDigestState that's optimized for high accuracy. It's substantially slower than the default implementation.
      Parameters:
      compression - the compression factor for the underlying TDigest object
      Returns:
      a TDigestState object that's optimized for performance
    • create

      public static TDigestState create(double compression, TDigestExecutionHint executionHint)
      Factory for TDigestState. The underlying TDigest implementation is either optimized for performance (default), potentially providing slightly inaccurate results for large populations, or optimized for accuracy but taking 2x-10x more to build.
      Parameters:
      compression - the compression factor for the underlying TDigest object
      executionHint - controls which implementation is used; accepted values are 'high_accuracy' and '' (default)
      Returns:
      a TDigestState object
    • createUsingParamsFrom

      public static TDigestState createUsingParamsFrom(TDigestState state)
      Factory for TDigestState. Uses the same initialization params as the passed TDigestState object. No data loading happens, and the input TDigestState object doesn't get altered in any way.
      Parameters:
      state - the TDigestState object providing the initialization params
      Returns:
      a TDigestState object
    • compression

      public final double compression()
    • write

      public static void write(TDigestState state, StreamOutput out) throws IOException
      Throws:
      IOException
    • read

      public static TDigestState read(StreamInput in) throws IOException
      Throws:
      IOException
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • add

      public void add(TDigestState other)
    • add

      public void add(double x, long w)
    • add

      public void add(double x)
    • compress

      public final void compress()
    • size

      public final long size()
    • cdf

      public final double cdf(double x)
    • quantile

      public final double quantile(double q)
    • centroids

      public final Collection<Centroid> centroids()
    • centroidCount

      public final int centroidCount()
    • getMin

      public final double getMin()
    • getMax

      public final double getMax()