TDIGEST.QUANTILE
Syntax
TDIGEST.QUANTILE key quantile [quantile ...]
- Available in:
- Redis Open Source / Bloom 2.4.0
- Time complexity:
- O(N) where N is the number of quantiles specified.
- ACL categories:
-
@tdigest
,@read
,
Returns, for each input fraction, a floating-point estimation of the value that is smaller than the given fraction of observations. Multiple quantiles can be retrieved in a single call.
Required arguments
key
is the key name for an existing t-digest sketch.
quantile
is the input fraction between 0 and 1 inclusively.
Examples
redis> TDIGEST.CREATE t COMPRESSION 1000
OK
redis> TDIGEST.ADD t 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
OK
redis> TDIGEST.QUANTILE t 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
1) "1"
2) "2"
3) "3"
4) "3"
5) "4"
6) "4"
7) "4"
8) "5"
9) "5"
10) "5"
11) "5"
Return information
One of the following:
- Array of bulk string replies as floating-point estimates, populated with value_1, value_2, ..., value_N.
- an accurate result when
quantile
is0
, the value of the smallest observation. - an accurate result when
quantile
is1
, the value of the largest observation. nan
for all quantiles when the given sketch is empty.
- an accurate result when
- Simple error reply in these cases: the given key does not exist or is of an incorrect type, quantile parsing errors, or incorrect number of arguments.