Class QuantileDigest


  • public class QuantileDigest
    extends Object
    Re-implement io.airlift.stats.QuantileDigest with additional methods facilitating serialization.
    • Constructor Detail

      • QuantileDigest

        public QuantileDigest​(double maxError)

        Create a QuantileDigest with a maximum error guarantee of "maxError" and no decay.

        Parameters:
        maxError - the max error tolerance
      • QuantileDigest

        public QuantileDigest​(double maxError,
                              double alpha)

        Create a QuantileDigest with a maximum error guarantee of "maxError" and exponential decay with factor "alpha".

        Parameters:
        maxError - the max error tolerance
        alpha - the exponential decay factor
      • QuantileDigest

        public QuantileDigest​(QuantileDigest quantileDigest)
    • Method Detail

      • getMaxError

        public double getMaxError()
      • getAlpha

        public double getAlpha()
      • add

        public void add​(long value)
      • add

        public void add​(long value,
                        long count)
        Adds a value to this digest. The value must be >= 0
      • getQuantiles

        public List<Long> getQuantiles​(List<Double> quantiles)
        Gets the values at the specified quantiles +/- maxError. The list of quantiles must be sorted in increasing order, and each value must be in the range [0, 1]
      • getQuantile

        public long getQuantile​(double quantile)
        Gets the value at the specified quantile +/- maxError. The quantile must be in the range [0, 1]
      • getCount

        public double getCount()
        Number (decayed) of elements added to this quantile digest
      • getMin

        public long getMin()
      • getMax

        public long getMax()
      • getByteSize

        public int getByteSize()
      • toBytes

        public byte[] toBytes()
      • fromBytes

        public static QuantileDigest fromBytes​(byte[] bytes)
      • getConfidenceFactor

        public double getConfidenceFactor()
        Computes the maximum error of the current digest
      • toGraphviz

        public String toGraphviz()
      • firstNonNull

        public static <T> T firstNonNull​(T first,
                                         T second)
      • offer

        public void offer​(long value)