public abstract class DualSketch extends Sketch
update()
, union()
and reset()
when performing the respective operations. It must also
call merge()
before performing any operations that change data in the sketch such as getting metadata or
results or resetting.Constructor and Description |
---|
DualSketch() |
Modifier and Type | Method and Description |
---|---|
protected void |
merge()
This method must be called before getting any kind of data out of the sketch.
|
protected abstract void |
mergeBothSketches()
Merge and reset both the update sketch and the union sketch into the result.
|
protected abstract void |
mergeUnionSketch()
Merge and reset just the union sketch into the result.
|
protected abstract void |
mergeUpdateSketch()
Merge and reset just the update sketch into the result.
|
void |
reset()
Resets the Sketch to the original state.
|
protected void |
union()
This method must be called after a
Sketch.union(byte[]) . |
protected abstract boolean |
unionedExistingResults()
Merge the existing result into the union sketch if needed and return a boolean if the union was done.
|
protected void |
update()
This method must be called after an update operation.
|
addMetadata, getFamily, getMetadata, getRecords, getResult, getSize, isEstimationMode, serialize, union
protected void update()
protected void union()
Sketch.union(byte[])
.protected void merge()
mergeBothSketches()
,
or merge its union sketch (mergeUnionSketch()
or just the update sketch (mergeUpdateSketch()
.
It will also ask to add any existing merged results back into the union sketch (unionedExistingResults()
). _
This method is idempotent and will not recollect till a data changing operation has been performed, such as an
update, union or a reset. This is why you must call the appropriate methods (update()
, union()
,
reset()
) defined in this class when performing those operations.protected abstract void mergeBothSketches()
protected abstract void mergeUpdateSketch()
protected abstract void mergeUnionSketch()
protected abstract boolean unionedExistingResults()
public void reset()
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.Copyright © 2021. All rights reserved.