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 |
---|---|
abstract CompactSketch |
compact(boolean dstOrdered,
org.apache.datasketches.memory.WritableMemory dstMem)
Convert this sketch to a new CompactSketch of the chosen order and direct or on the heap.
|
int |
getCompactBytes()
Returns the number of storage bytes required for this Sketch if its current state were
compacted.
|
Family |
getFamily()
Returns the Family that this sketch belongs to
|
boolean |
isCompact()
Returns true if this sketch is in compact form.
|
compact, getCountLessThanTheta, getCountLessThanThetaLong, getCurrentBytes, 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, wrap
public abstract CompactSketch compact(boolean dstOrdered, org.apache.datasketches.memory.WritableMemory dstMem)
Sketch
If this sketch is already in the proper form, this operation returns this, otherwise, this method returns a new CompactSketch of the proper form.
If this sketch is a type of UpdateSketch, the compacting process converts the hash table of the UpdateSketch to a simple list of the valid hash values. Any hash values of zero or equal-to or greater than theta will be discarded. The number of valid values remaining in the CompactSketch 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 calling this method.
A CompactSketch is always immutable.
compact
in class Sketch
dstOrdered
- See Destination OrdereddstMem
- See Destination Memory.public int getCompactBytes()
Sketch
Sketch.getCurrentBytes()
.getCompactBytes
in class Sketch
public Family getFamily()
Sketch
Copyright © 2015–2021 The Apache Software Foundation. All rights reserved.