@TypeInfo(value=QuantileSummaryTypeInfoFactory.class) public class QuantileSummary extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
QuantileSummary.StatsTuple
Wrapper class to hold all statistics from the Greenwald-Khanna paper.
|
Constructor and Description |
---|
QuantileSummary()
Empty QuantileSummary Constructor.
|
QuantileSummary(double relativeError)
QuantileSummary Constructor.
|
QuantileSummary(double relativeError,
int compressThreshold)
QuantileSummary Constructor.
|
QuantileSummary(double relativeError,
int compressThreshold,
List<QuantileSummary.StatsTuple> sampled,
long count,
boolean compressed)
QuantileSummary Constructor.
|
Modifier and Type | Method and Description |
---|---|
QuantileSummary |
compress()
Returns a new summary that compresses the summary statistics and the head buffer.
|
int |
getCompressThreshold() |
long |
getCount() |
List<Double> |
getHeadBuffer() |
double |
getRelativeError() |
List<QuantileSummary.StatsTuple> |
getSampled() |
QuantileSummary |
insert(double item)
Insert a new observation into the summary.
|
boolean |
isCompressed() |
boolean |
isEmpty()
Checks whether the QuantileSummary has inserted rows.
|
QuantileSummary |
merge(QuantileSummary other)
Merges two summaries together.
|
double |
query(double percentile)
Runs a query for a given percentile.
|
double[] |
query(double[] percentiles)
Runs a query for a given sequence of percentiles.
|
public QuantileSummary()
public QuantileSummary(double relativeError)
relativeError
- The target relative error.public QuantileSummary(double relativeError, int compressThreshold)
relativeError
- The target relative error.compressThreshold
- the compression threshold. After the internal buffer of statistics
crosses this size, it attempts to compress the statistics together.public QuantileSummary(double relativeError, int compressThreshold, List<QuantileSummary.StatsTuple> sampled, long count, boolean compressed)
relativeError
- The target relative error.compressThreshold
- the compression threshold.sampled
- A buffer of quantile statistics. See the G-K article for more details.count
- The count of all the elements inserted in the sampled buffer.compressed
- Whether the statistics have been compressed.public QuantileSummary insert(double item)
item
- The new observation to insert into the summary.public QuantileSummary compress()
This implements the COMPRESS function of the GK algorithm.
public QuantileSummary merge(QuantileSummary other)
other
- The summary to be merged.public double query(double percentile)
percentile
- The target percentile.public double[] query(double[] percentiles)
percentiles
- A list of the target percentiles.public boolean isEmpty()
IllegalStateException
.public double getRelativeError()
public int getCompressThreshold()
public long getCount()
public List<QuantileSummary.StatsTuple> getSampled()
public boolean isCompressed()
Copyright © 2019–2023 The Apache Software Foundation. All rights reserved.