public class TopKSampler<T>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
TopKSampler.SamplerResult<S>
Represents the cardinality and the topK ranked items collected during a
sample period
|
Constructor and Description |
---|
TopKSampler() |
Modifier and Type | Method and Description |
---|---|
void |
addSample(T item) |
void |
addSample(T item,
long hash,
int value)
Adds a sample to statistics collection.
|
void |
beginSampling(int capacity)
Start to record samples
|
TopKSampler.SamplerResult<T> |
finishSampling(int count)
Call to stop collecting samples, and gather the results
|
public void beginSampling(int capacity)
capacity
- Number of sample items to keep in memory, the lower this is
the less accurate results are. For best results use value
close to cardinality, but understand the memory trade offs.public TopKSampler.SamplerResult<T> finishSampling(int count)
count
- Number of most frequent items to returnpublic void addSample(T item)
public void addSample(T item, long hash, int value)
Copyright © 2020 The Apache Software Foundation