Package org.apache.datasketches.tuple
Class CompactSketch<S extends Summary>
java.lang.Object
org.apache.datasketches.tuple.Sketch<S>
org.apache.datasketches.tuple.CompactSketch<S>
- Type Parameters:
S- type of Summary
public class CompactSketch<S extends Summary> extends Sketch<S>
CompactSketches are never created directly. They are created as a result of
the compact() method of an UpdatableSketch or as a result of the getResult()
method of a set operation like Union, Intersection or AnotB. CompactSketch
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. CompactSketch is read-only.
-
Field Summary
-
Method Summary
Modifier and Type Method Description CompactSketch<S>compact()Converts this sketch to a CompactSketch on the Java heap.intgetCountLessThanThetaLong(long thetaLong)Gets the number of hash values less than the given theta expressed as a long.intgetRetainedEntries()SketchIterator<S>iterator()Returns a SketchIteratorbyte[]toByteArray()This is to serialize an instance to a byte array.Methods inherited from class org.apache.datasketches.tuple.Sketch
getEstimate, getEstimate, getLowerBound, getLowerBound, getTheta, getThetaLong, getUpperBound, getUpperBound, isEmpty, isEstimationMode, toString
-
Method Details
-
compact
Description copied from class:SketchConverts this sketch to a CompactSketch on the Java heap.If this sketch is already in compact form this operation returns this.
-
getRetainedEntries
public int getRetainedEntries()- Specified by:
getRetainedEntriesin classSketch<S extends Summary>- Returns:
- number of retained entries
-
getCountLessThanThetaLong
public int getCountLessThanThetaLong(long thetaLong)Description copied from class:SketchGets the number of hash values less than the given theta expressed as a long.- Specified by:
getCountLessThanThetaLongin classSketch<S extends Summary>- Parameters:
thetaLong- the given theta as a long between zero and Long.MAX_VALUE.- Returns:
- the number of hash values less than the given thetaLong.
-
toByteArray
public byte[] toByteArray()Description copied from class:SketchThis is to serialize an instance to a byte array.- Specified by:
toByteArrayin classSketch<S extends Summary>- Returns:
- serialized representation of the sketch
-
iterator
Description copied from class:SketchReturns a SketchIterator
-