public class TupleSketch extends KMVSketch
META_STD_DEV_1, META_STD_DEV_2, META_STD_DEV_3, META_STD_DEV_LB, META_STD_DEV_UB| Constructor and Description |
|---|
TupleSketch(com.yahoo.sketches.ResizeFactor resizeFactor,
float samplingProbability,
int nominalEntries,
int maxSize,
com.yahoo.bullet.record.BulletRecordProvider provider)
Initialize a tuple sketch for summarizing group data.
|
| Modifier and Type | Method and Description |
|---|---|
protected Map<String,Object> |
addMetadata(Map<String,String> conceptKeys)
Adds the common metadata for this Sketch to
Map. |
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 key,
CachingGroupData data)
Update the sketch with a key representing a group and the data for it.
|
merge, union, updategetMetadatapublic TupleSketch(com.yahoo.sketches.ResizeFactor resizeFactor,
float samplingProbability,
int nominalEntries,
int maxSize,
com.yahoo.bullet.record.BulletRecordProvider provider)
resizeFactor - The ResizeFactor to use for the sketch.samplingProbability - The sampling probability to use.nominalEntries - The nominal entries for the sketch.maxSize - The maximum size of groups to return.provider - A BulletRecordProvider to generate BulletRecords.public void update(String key, CachingGroupData data)
key - The key to present the data to the sketch as.data - The data for the group.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 Map<String,Object> addMetadata(Map<String,String> conceptKeys)
SketchMap.addMetadata in class KMVSketchconceptKeys - The Map of Meta.Concept names to their keys.Map of sketch metadata.protected 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.