Module org.elasticsearch.server
Class TDigestState
java.lang.Object
org.elasticsearch.search.aggregations.metrics.TDigestState
- Direct Known Subclasses:
EmptyTDigestState
Decorates
TDigest
with custom serialization. The underlying implementation for TDigest is selected
through factory method params, providing one optimized for performance (e.g. MergingDigest or HybridDigest) by default, or optionally one
that produces highly accurate results regardless of input size but its construction over the sample population takes 2x-10x longer.-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(double x) void
add
(double x, long w) void
add
(TDigestState other) final double
cdf
(double x) final int
final Collection<Centroid>
final void
compress()
final double
static TDigestState
create
(double compression) Default factory for TDigestState.static TDigestState
create
(double compression, TDigestExecutionHint executionHint) Factory for TDigestState.static TDigestState
createOptimizedForAccuracy
(double compression) Factory for TDigestState that's optimized for high accuracy.static TDigestState
Factory for TDigestState.boolean
final double
getMax()
final double
getMin()
int
hashCode()
final double
quantile
(double q) static TDigestState
read
(StreamInput in) final long
size()
static void
write
(TDigestState state, StreamOutput out)
-
Constructor Details
-
TDigestState
-
-
Method Details
-
create
Default factory for TDigestState. The underlyingTDigest
implementation is optimized for performance, potentially providing slightly inaccurate results compared to other, substantially slower implementations.- Parameters:
compression
- the compression factor for the underlyingTDigest
object- Returns:
- a TDigestState object that's optimized for performance
-
createOptimizedForAccuracy
Factory for TDigestState that's optimized for high accuracy. It's substantially slower than the default implementation.- Parameters:
compression
- the compression factor for the underlyingTDigest
object- Returns:
- a TDigestState object that's optimized for performance
-
create
Factory for TDigestState. The underlyingTDigest
implementation is either optimized for performance (default), potentially providing slightly inaccurate results for large populations, or optimized for accuracy but taking 2x-10x more to build.- Parameters:
compression
- the compression factor for the underlyingTDigest
objectexecutionHint
- controls which implementation is used; accepted values are 'high_accuracy' and '' (default)- Returns:
- a TDigestState object
-
createUsingParamsFrom
Factory for TDigestState. Uses the same initialization params as the passed TDigestState object. No data loading happens, and the input TDigestState object doesn't get altered in any way.- Parameters:
state
- the TDigestState object providing the initialization params- Returns:
- a TDigestState object
-
compression
public final double compression() -
write
- Throws:
IOException
-
read
- Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
add
-
add
public void add(double x, long w) -
add
public void add(double x) -
compress
public final void compress() -
size
public final long size() -
cdf
public final double cdf(double x) -
quantile
public final double quantile(double q) -
centroids
-
centroidCount
public final int centroidCount() -
getMin
public final double getMin() -
getMax
public final double getMax()
-