tdigest_quantile¶
Description¶
Calculates a quantile from a TDigest state.
Return type¶
numeric or duration
Domain¶
This is a scalar function (calculates a single output value for a single input row.)
Categories¶
Usage¶
tdigest_quantile(inputExpr, quantile)
Argument |
Type |
Optional |
Repeatable |
Restrictions |
---|---|---|---|---|
inputExpr |
tdigest |
no |
no |
none |
quantile |
numeric |
no |
no |
constant |
Examples¶
make_col quantile:tdigest_quantile(tdigest_col, .95)
Calculate the 95nd percentile of the data summarized in tdigest_col
.
timechart 5m, durations_tdigest:tdigest(duration_col), group_by(^Cluster)
statsby quantile:tdigest_quantile(durations_tdigest, .98)
This is the typical use case: use t-digest to pre-aggregate numeric values with a decomposable aggregate function, and ultimately calculating a quantile value from it.
First, aggregate the durations both in time buckets of the desired width and by Cluster.
Then, calculate the 98th percentile.