public abstract class CompactSketch extends Sketch
A CompactSketch is the simplest form of a Theta Sketch. It consists of a compact list (i.e., no intervening spaces) of hash values, which may be ordered or not, a value for theta and a seed hash. A CompactSketch is read-only, and the space required when stored is only the space required for the hash values and 8 to 24 bytes of preamble. An empty CompactSketch consumes only 8 bytes.
| Constructor and Description |
|---|
CompactSketch() |
| Modifier and Type | Method and Description |
|---|---|
CompactSketch |
compact()
Converts this sketch to an ordered CompactSketch on the Java heap.
|
CompactSketch |
compact(boolean dstOrdered,
org.apache.datasketches.memory.WritableMemory dstMem)
Convert this sketch to a CompactSketch in the chosen form.
|
Family |
getFamily()
Returns the Family that this sketch belongs to
|
boolean |
isCompact()
Returns true if this sketch is in compact form.
|
getCountLessThanTheta, getCurrentBytes, getEstimate, getLowerBound, getMaxCompactSketchBytes, getMaxUpdateSketchBytes, getRetainedEntries, getRetainedEntries, getSerializationVersion, getTheta, getThetaLong, getUpperBound, hasMemory, heapify, heapify, isDirect, isEmpty, isEstimationMode, isOrdered, isSameResource, iterator, toByteArray, toString, toString, toString, toString, wrap, wrappublic CompactSketch compact()
SketchIf this sketch is already in compact form this operation returns this.
public CompactSketch compact(boolean dstOrdered, org.apache.datasketches.memory.WritableMemory dstMem)
SketchIf this sketch is already in compact form this operation returns this.
Otherwise, this compacting process converts the hash table form of an UpdateSketch to a simple list of the valid hash values from the hash table. Any hash values equal to or greater than theta will be discarded. The number of valid values remaining in the Compact Sketch depends on a number of factors, but may be larger or smaller than Nominal Entries (or k). It will never exceed 2k. If it is critical to always limit the size to no more than k, then rebuild() should be called on the UpdateSketch prior to this.
compact in class SketchdstOrdered - See Destination OrdereddstMem - See Destination Memory.public Family getFamily()
SketchCopyright © 2015–2020 The Apache Software Foundation. All rights reserved.