public abstract class UpdateSketch extends Sketch
| Modifier and Type | Method and Description |
|---|---|
static UpdateSketchBuilder |
builder()
Returns a new builder
|
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.
|
abstract int |
getLgNomLongs()
Gets the Log base 2 of the configured nominal entries
|
abstract ResizeFactor |
getResizeFactor()
Returns the configured ResizeFactor
|
static UpdateSketch |
heapify(org.apache.datasketches.memory.Memory srcMem)
Instantiates an on-heap UpdateSketch from Memory.
|
static UpdateSketch |
heapify(org.apache.datasketches.memory.Memory srcMem,
long seed)
Instantiates an on-heap UpdateSketch from Memory.
|
boolean |
isCompact()
Returns true if this sketch is in compact form.
|
boolean |
isOrdered()
Returns true if internal cache is ordered
|
abstract UpdateSketch |
rebuild()
Rebuilds the hash table to remove dirty values or to reduce the size
to nominal entries.
|
abstract void |
reset()
Resets this sketch back to a virgin empty state.
|
UpdateReturnState |
update(byte[] data)
Present this sketch with the given byte array.
|
UpdateReturnState |
update(char[] data)
Present this sketch with the given char array.
|
UpdateReturnState |
update(double datum)
Present this sketch with the given double (or float) datum.
|
UpdateReturnState |
update(int[] data)
Present this sketch with the given integer array.
|
UpdateReturnState |
update(long datum)
Present this sketch with a long.
|
UpdateReturnState |
update(long[] data)
Present this sketch with the given long array.
|
UpdateReturnState |
update(String datum)
Present this sketch with the given String.
|
static UpdateSketch |
wrap(org.apache.datasketches.memory.WritableMemory srcMem)
Wrap takes the sketch image in Memory and refers to it directly.
|
static UpdateSketch |
wrap(org.apache.datasketches.memory.WritableMemory srcMem,
long seed)
Wrap takes the sketch image in Memory and refers to it directly.
|
getCountLessThanTheta, getCurrentBytes, getEstimate, getFamily, getLowerBound, getMaxCompactSketchBytes, getMaxUpdateSketchBytes, getRetainedEntries, getRetainedEntries, getSerializationVersion, getTheta, getThetaLong, getUpperBound, hasMemory, isDirect, isEmpty, isEstimationMode, isSameResource, iterator, toByteArray, toString, toString, toString, toString, wrap, wrappublic static UpdateSketch wrap(org.apache.datasketches.memory.WritableMemory srcMem)
Util.DEFAULT_UPDATE_SEED.
Default Update Seed.srcMem - an image of a Sketch where the image seed hash matches the default seed hash.
See Memorypublic static UpdateSketch wrap(org.apache.datasketches.memory.WritableMemory srcMem, long seed)
srcMem - an image of a Sketch where the image seed hash matches the given seed hash.
See Memoryseed - See Update Hash Seed.
Compact sketches store a 16-bit hash of the seed, but not the seed itself.public static UpdateSketch heapify(org.apache.datasketches.memory.Memory srcMem)
Util.DEFAULT_UPDATE_SEED.srcMem - See Memorypublic static UpdateSketch heapify(org.apache.datasketches.memory.Memory srcMem, long seed)
srcMem - See Memoryseed - See Update Hash Seed.public 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 boolean isCompact()
Sketchpublic boolean isOrdered()
Sketchpublic static final UpdateSketchBuilder builder()
public abstract void reset()
public abstract UpdateSketch rebuild()
public abstract ResizeFactor getResizeFactor()
public UpdateReturnState update(long datum)
datum - The given long datum.public UpdateReturnState update(double datum)
datum - The given double datum.public UpdateReturnState update(String datum)
Note: this will not produce the same output hash values as the update(char[])
method and will generally be a little slower depending on the complexity of the UTF8 encoding.
datum - The given String.public UpdateReturnState update(byte[] data)
data - The given byte array.public UpdateReturnState update(char[] data)
Note: this will not produce the same output hash values as the update(String)
method but will be a little faster as it avoids the complexity of the UTF8 encoding.
data - The given char array.public UpdateReturnState update(int[] data)
data - The given int array.public UpdateReturnState update(long[] data)
data - The given long array.public abstract int getLgNomLongs()
Copyright © 2015–2020 The Apache Software Foundation. All rights reserved.