org.apache.spark.sql.catalyst.util

QuantileSummaries

class QuantileSummaries extends Serializable

Helper class to compute approximate quantile summary. This implementation is based on the algorithm proposed in the paper: "Space-efficient Online Computation of Quantile Summaries" by Greenwald, Michael and Khanna, Sanjeev. (http://dx.doi.org/10.1145/375663.375670)

In order to optimize for speed, it maintains an internal buffer of the last seen samples, and only inserts them after crossing a certain size threshold. This guarantees a near-constant runtime complexity compared to the original algorithm.

Linear Supertypes
Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. QuantileSummaries
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new QuantileSummaries(compressThreshold: Int, relativeError: Double, sampled: Array[Stats] = ..., count: Long = 0L)

    compressThreshold

    the compression threshold. After the internal buffer of statistics crosses this size, it attempts to compress the statistics together.

    relativeError

    the target relative error. It is uniform across the complete range of values.

    sampled

    a buffer of quantile statistics. See the G-K article for more details.

    count

    the count of all the elements *inserted in the sampled buffer* (excluding the head buffer)

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def compress(): QuantileSummaries

    Returns a new summary that compresses the summary statistics and the head buffer.

    Returns a new summary that compresses the summary statistics and the head buffer.

    This implements the COMPRESS function of the GK algorithm. It does not modify the object.

    returns

    a new summary object with compressed statistics

  9. val compressThreshold: Int

    the compression threshold.

    the compression threshold. After the internal buffer of statistics crosses this size, it attempts to compress the statistics together.

  10. val count: Long

    the count of all the elements *inserted in the sampled buffer* (excluding the head buffer)

  11. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  13. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  15. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  16. def insert(x: Double): QuantileSummaries

    Returns a summary with the given observation inserted into the summary.

    Returns a summary with the given observation inserted into the summary. This method may either modify in place the current summary (and return the same summary, modified in place), or it may create a new summary from scratch it necessary.

    x

    the new observation to insert into the summary

  17. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  18. def merge(other: QuantileSummaries): QuantileSummaries

    Merges two (compressed) summaries together.

    Merges two (compressed) summaries together.

    Returns a new summary.

  19. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  20. final def notify(): Unit

    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  22. def query(quantile: Double): Double

    Runs a query for a given quantile.

    Runs a query for a given quantile. The result follows the approximation guarantees detailed above. The query can only be run on a compressed summary: you need to call compress() before using it.

    quantile

    the target quantile

    returns

  23. val relativeError: Double

    the target relative error.

    the target relative error. It is uniform across the complete range of values.

  24. val sampled: Array[Stats]

    a buffer of quantile statistics.

    a buffer of quantile statistics. See the G-K article for more details.

  25. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  26. def toString(): String

    Definition Classes
    AnyRef → Any
  27. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped