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.
|
addMetadata
merge, union, update
getMetadata
public 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)
Sketch
Sketch.serialize()
into this.public byte[] serialize()
Sketch
public List<com.yahoo.bullet.record.BulletRecord> getRecords()
Sketch
List
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 Sketch
public Clip getResult(String metaKey, Map<String,String> conceptKeys)
Sketch
getResult
in class Sketch
metaKey
- 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()
DualSketch
Sketch.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 DualSketch
protected void mergeBothSketches()
DualSketch
mergeBothSketches
in class DualSketch
protected void mergeUpdateSketch()
DualSketch
mergeUpdateSketch
in class DualSketch
protected void mergeUnionSketch()
DualSketch
mergeUnionSketch
in class DualSketch
protected boolean unionedExistingResults()
DualSketch
unionedExistingResults
in class DualSketch
protected Boolean isEstimationMode()
Sketch
isEstimationMode
in class Sketch
protected String getFamily()
Sketch
protected Integer getSize()
Sketch
protected Double getTheta()
KMVSketch
DualSketch.merge()
.protected Double getLowerBound(int standardDeviation)
KMVSketch
DualSketch.merge()
.getLowerBound
in class KMVSketch
standardDeviation
- The standard deviation.protected Double getUpperBound(int standardDeviation)
KMVSketch
DualSketch.merge()
.getUpperBound
in class KMVSketch
standardDeviation
- The standard deviation.Copyright © 2021. All rights reserved.