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
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.
-
Method Summary
Modifier and TypeMethodDescriptioncompact()
Converts this sketch to a CompactSketch on the Java heap.int
getCountLessThanThetaLong
(long thetaLong) Gets the number of hash values less than the given theta expressed as a long.int
iterator()
Returns a SketchIteratorbyte[]
This is to serialize a sketch instance to a byte array.Methods inherited from class org.apache.datasketches.tuple.Sketch
getEstimate, getEstimate, getLowerBound, getLowerBound, getSummaryFactory, getTheta, getThetaLong, getUpperBound, getUpperBound, isEmpty, isEstimationMode, toString
-
Method Details
-
compact
Description copied from class:Sketch
Converts 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:
getRetainedEntries
in classSketch<S extends Summary>
- Returns:
- number of retained entries
-
getCountLessThanThetaLong
public int getCountLessThanThetaLong(long thetaLong) Description copied from class:Sketch
Gets the number of hash values less than the given theta expressed as a long.- Specified by:
getCountLessThanThetaLong
in 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:Sketch
This is to serialize a sketch instance to a byte array.As of 3.0.0, serializing an UpdatableSketch is deprecated. This capability will be removed in a future release. Serializing a CompactSketch is not deprecated.
- Specified by:
toByteArray
in classSketch<S extends Summary>
- Returns:
- serialized representation of the sketch
-
iterator
Description copied from class:Sketch
Returns a SketchIterator
-