Class CompactTupleSketch<S extends Summary>

java.lang.Object
org.apache.datasketches.tuple.TupleSketch<S>
org.apache.datasketches.tuple.CompactTupleSketch<S>
Type Parameters:
S - type of Summary

public final class CompactTupleSketch<S extends Summary> extends TupleSketch<S>
CompactTupleSketches are never created directly. They are created as a result of the compact() method of an UpdatableTupleSketch or as a result of the getResult() method of a set operation like TupleUnion, TupleIntersection or TupleAnotB. CompactTupleSketch consists of a compact list (i.e. no intervening spaces) of hash values, corresponding list of Summaries, and a value for theta. The lists may or may not be ordered. CompactTupleSketch is read-only.
  • Method Details

    • compact

      public CompactTupleSketch<S> compact()
      Description copied from class: TupleSketch
      Converts this TupleSketch to a CompactTupleSketch on the Java heap.

      If this sketch is already in compact form this operation returns this.

      Specified by:
      compact in class TupleSketch<S extends Summary>
      Returns:
      this sketch as a CompactTupleSketch on the Java heap.
    • getRetainedEntries

      public int getRetainedEntries()
      Description copied from class: TupleSketch
      Returns number of retained entries
      Specified by:
      getRetainedEntries in class TupleSketch<S extends Summary>
      Returns:
      number of retained entries
    • getCountLessThanThetaLong

      public int getCountLessThanThetaLong(long thetaLong)
      Description copied from class: TupleSketch
      Gets the number of hash values less than the given theta expressed as a long.
      Specified by:
      getCountLessThanThetaLong in class TupleSketch<S extends Summary>
      Parameters:
      thetaLong - the given theta as a long in the range (zero, Long.MAX_VALUE].
      Returns:
      the number of hash values less than the given thetaLong.
    • toByteArray

      public byte[] toByteArray()
      Description copied from class: TupleSketch
      Serialize this sketch to a byte array.

      As of 3.0.0, serializing an UpdatableTupleSketch is deprecated. This capability will be removed in a future release. Serializing a CompactTupleSketch is not deprecated.

      Specified by:
      toByteArray in class TupleSketch<S extends Summary>
      Returns:
      serialized representation of this sketch.
    • iterator

      public TupleSketchIterator<S> iterator()
      Description copied from class: TupleSketch
      Returns a SketchIterator
      Specified by:
      iterator in class TupleSketch<S extends Summary>
      Returns:
      a SketchIterator