public class StreamingTombstoneHistogramBuilder
extends java.lang.Object
SSTableReader.getDroppableTombstonesBefore(int)
.
When an sstable is written (or streamed), this histogram-builder receives the "local deletion timestamp"
as an int
via update(int)
. Negative values are not supported.
Algorithm: Histogram is represented as collection of {point, weight} pairs. When new point p with weight m is added:
There are some optimization to make histogram builder faster:
The original algorithm is taken from following paper: Yael Ben-Haim and Elad Tom-Tov, "A Streaming Parallel Decision Tree Algorithm" (2010) http://jmlr.csail.mit.edu/papers/volume11/ben-haim10a/ben-haim10a.pdf
Constructor and Description |
---|
StreamingTombstoneHistogramBuilder(int maxBinSize,
int maxSpoolSize,
int roundSeconds) |
Modifier and Type | Method and Description |
---|---|
TombstoneHistogram |
build()
Creates a 'finished' snapshot of the current state of the histogram, but leaves this builder instance
open for subsequent additions to the histograms.
|
void |
flushHistogram()
Drain the temporary spool into the final bins
|
void |
releaseBuffers()
Release inner spool buffers.
|
static int |
saturatingCastToInt(long value) |
static int |
saturatingCastToMaxDeletionTime(long value)
Cast to an int with maximum value of
Cell.MAX_DELETION_TIME to avoid representing values that
aren't a tombstone |
void |
update(int point)
Adds new point to this histogram with a default value of 1.
|
void |
update(int point,
int value)
Adds new point with value to this histogram.
|
public StreamingTombstoneHistogramBuilder(int maxBinSize, int maxSpoolSize, int roundSeconds)
public void update(int point)
point
- the point to be addedpublic void update(int point, int value)
public void flushHistogram()
public void releaseBuffers()
public TombstoneHistogram build()
public static int saturatingCastToInt(long value)
public static int saturatingCastToMaxDeletionTime(long value)
Cell.MAX_DELETION_TIME
to avoid representing values that
aren't a tombstoneCopyright © 2009-2021 The Apache Software Foundation