public class ThetaSketch extends KMVSketch
| Modifier and Type | Field and Description |
|---|---|
static String |
COUNT_FIELD |
META_STD_DEV_1, META_STD_DEV_2, META_STD_DEV_3, META_STD_DEV_LB, META_STD_DEV_UB| Constructor and Description |
|---|
ThetaSketch(com.yahoo.sketches.ResizeFactor resizeFactor,
com.yahoo.sketches.Family family,
float samplingProbability,
int nominalEntries,
com.yahoo.bullet.record.BulletRecordProvider provider)
Constructor for creating a theta sketch.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
getFamily()
Returns a String representing the family of this sketch.
|
protected Double |
getLowerBound(int standardDeviation)
Gets the lower bound at this standard deviation after the last createResult.
|
List<com.yahoo.bullet.record.BulletRecord> |
getRecords()
Collects the data presented to the sketch so far and returns the
List of BulletRecord
representation of the resulting data in the sketch. |
Clip |
getResult(String metaKey,
Map<String,String> conceptKeys)
Gets the result from the data presented to the sketch as a
Clip. |
protected Integer |
getSize()
Returns the size of the Sketch in bytes.
|
protected Double |
getTheta()
Gets the theta value for this sketch after the last createResult.
|
protected Double |
getUpperBound(int standardDeviation)
Gets the uppper bound at this standard deviation after the last createResult.
|
protected Boolean |
isEstimationMode()
Returns whether this sketch was in estimation mode or not.
|
protected void |
mergeBothSketches()
Merge and reset both the update sketch and the union sketch into the result.
|
protected void |
mergeUnionSketch()
Merge and reset just the union sketch into the result.
|
protected void |
mergeUpdateSketch()
Merge and reset just the update sketch into the result.
|
void |
reset()
Resets the Sketch to the original state.
|
byte[] |
serialize()
Serializes the sketch.
|
void |
union(byte[] serialized)
Union a sketch serialized using
Sketch.serialize() into this. |
protected boolean |
unionedExistingResults()
Merge the existing result into the union sketch if needed and return a boolean if the union was done.
|
void |
update(String field)
Update the sketch with a String field.
|
addMetadatamerge, union, updategetMetadatapublic static final String COUNT_FIELD
public ThetaSketch(com.yahoo.sketches.ResizeFactor resizeFactor,
com.yahoo.sketches.Family family,
float samplingProbability,
int nominalEntries,
com.yahoo.bullet.record.BulletRecordProvider provider)
resizeFactor - The ResizeFactor to use for the sketch.family - The Family to use.samplingProbability - The sampling probability to use.nominalEntries - The nominal entries for the sketch.provider - A BulletRecordProvider to generate BulletRecords.public void update(String field)
field - The field to present to the sketch.public void union(byte[] serialized)
SketchSketch.serialize() into this.public byte[] serialize()
Sketchpublic List<com.yahoo.bullet.record.BulletRecord> getRecords()
SketchList of BulletRecord
representation of the resulting data in the sketch. See Sketch.getResult(String, Map) for getting the
result including the metadata and see Sketch.getMetadata(String, Map) for getting only the metadata.getRecords in class Sketchpublic Clip getResult(String metaKey, Map<String,String> conceptKeys)
SketchgetResult in class SketchmetaKey - If set to a non-null value, Sketch metadata will be added to the result.conceptKeys - If provided, these Meta.Concept names will be added to the metadata.Clip of the results.public void reset()
DualSketchSketch.serialize() or Sketch.getResult(String, Map) if you want to add more data to the sketch.
Call this after your reset operations to reset the metadata relating to storing two sketches. You should
reset or remove all your sketches here.reset in class DualSketchprotected void mergeBothSketches()
DualSketchmergeBothSketches in class DualSketchprotected void mergeUpdateSketch()
DualSketchmergeUpdateSketch in class DualSketchprotected void mergeUnionSketch()
DualSketchmergeUnionSketch in class DualSketchprotected boolean unionedExistingResults()
DualSketchunionedExistingResults in class DualSketchprotected Boolean isEstimationMode()
SketchisEstimationMode in class Sketchprotected String getFamily()
Sketchprotected Integer getSize()
Sketchprotected Double getTheta()
KMVSketchDualSketch.merge().protected Double getLowerBound(int standardDeviation)
KMVSketchDualSketch.merge().getLowerBound in class KMVSketchstandardDeviation - The standard deviation.protected Double getUpperBound(int standardDeviation)
KMVSketchDualSketch.merge().getUpperBound in class KMVSketchstandardDeviation - The standard deviation.Copyright © 2021. All rights reserved.