Skip to content

Commit 2cd2b26

Browse files
committed
DEV: add RESP2/3 return information to the t-digest commands
1 parent d3d6b26 commit 2cd2b26

14 files changed

+454
-164
lines changed

content/commands/tdigest.add.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,14 @@ Adds one or more observations to a t-digest sketch.
4040
## Required arguments
4141

4242
<details open><summary><code>key</code></summary>
43-
is key name for an existing t-digest sketch.
44-
</details>
4543

46-
<details open><summary><code>value</code></summary>
47-
is value of an observation (floating-point).
44+
is the key name for an existing t-digest sketch.
4845
</details>
4946

50-
## Return value
47+
<details open><summary><code>value</code></summary>
5148

52-
[Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) - `OK` if executed correctly, or [] otherwise.
49+
is the floating-point value of an observation.
50+
</details>
5351

5452
## Examples
5553

@@ -62,3 +60,23 @@ OK
6260
redis> TDIGEST.ADD t string
6361
(error) ERR T-Digest: error parsing val parameter
6462
{{< / highlight >}}
63+
64+
## Return information
65+
66+
{{< multitabs id=“tdigest-add-return-info"
67+
tab1="RESP2"
68+
tab2="RESP3" >}}
69+
70+
One of the following:
71+
72+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) `OK` if executed correctly.
73+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: the given key does not exist or the value parameter is of the incorrect type.
74+
75+
-tab-sep-
76+
77+
One of the following:
78+
79+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) `OK` if executed correctly.
80+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: the given key does not exist or the value parameter is of the incorrect type.
81+
82+
{{< /multitabs >}}

content/commands/tdigest.byrank.md

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,51 +19,40 @@ categories:
1919
- kubernetes
2020
- clients
2121
complexity: O(N) where N is the number of ranks specified.
22-
description: Returns, for each input rank, an estimation of the value (floating-point)
22+
description: Returns, for each input rank, a floating-point estimation of the value
2323
with that rank
2424
group: tdigest
2525
hidden: false
2626
linkTitle: TDIGEST.BYRANK
2727
module: Bloom
2828
since: 2.4.0
2929
stack_path: docs/data-types/probabilistic
30-
summary: Returns, for each input rank, an estimation of the value (floating-point)
30+
summary: Returns, for each input rank, a floating-point estimation of the value
3131
with that rank
3232
syntax_fmt: TDIGEST.BYRANK key rank [rank ...]
3333
syntax_str: rank [rank ...]
3434
title: TDIGEST.BYRANK
3535
---
36-
Returns, for each input rank, an estimation of the value (floating-point) with that rank.
37-
38-
Multiple estimations can be retrieved in a signle call.
36+
Returns, for each input rank, a floating-point estimation of the value with that rank.
37+
Multiple estimations can be retrieved in a single call.
3938

4039
## Required arguments
4140

4241
<details open><summary><code>key</code></summary>
43-
is key name for an existing t-digest sketch.
42+
43+
is the key name of an existing t-digest sketch.
4444
</details>
4545

4646
<details open><summary><code>rank</code></summary>
4747

48-
Rank, for which the value should be retrieved.
48+
Ranks for which the values should be retrieved.
4949

5050
0 is the rank of the value of the smallest observation.
5151

52-
_n_-1 is the rank of the value of the largest observation; _n_ denotes the number of observations added to the sketch.
53-
52+
_n_-1 is the rank of the value of the largest observation, where _n_ denotes the number of observations that have been added to the sketch.
5453
</details>
5554

56-
## Return value
57-
58-
[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) - an array of floating-points populated with value_1, value_2, ..., value_R:
59-
60-
- Return an accurate result when `rank` is 0 (the value of the smallest observation)
61-
- Return an accurate result when `rank` is _n_-1 (the value of the largest observation), where _n_ denotes the number of observations added to the sketch.
62-
- Return 'inf' when `rank` is equal to _n_ or larger than _n_
63-
64-
All values are 'nan' if the sketch is empty.
65-
66-
## Examples
55+
## Example
6756

6857
{{< highlight bash >}}
6958
redis> TDIGEST.CREATE t COMPRESSION 1000
@@ -88,3 +77,31 @@ redis> TDIGEST.BYRANK t 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
8877
15) "5"
8978
16) "inf"
9079
{{< / highlight >}}
80+
81+
## Return information
82+
83+
{{< multitabs id=“tdigest-byrank-return-info"
84+
tab1="RESP2"
85+
tab2="RESP3" >}}
86+
87+
One of the following:
88+
89+
* [Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk strings]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) as floating-points, populated with value_1, value_2, ..., value_R:
90+
* an accurate result when `rank` is `0`, the value of the smallest observation.
91+
* an accurate result when `rank` is _n_-1, the value of the largest observation, where _n_ denotes the number of observations added to the sketch.
92+
* `inf` when `rank` is equal to _n_ or larger than _n_.
93+
* `nan` for all ranks when the given sketch is empty.
94+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: the given key does not exist or is of an incorrect type, rank parsing errors, or incorrect number of arguments.
95+
96+
-tab-sep-
97+
98+
One of the following:
99+
100+
* [Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [doubles]({{< relref "/develop/reference/protocol-spec#doubles" >}}) as floating-points, populated with value_1, value_2, ..., value_R:
101+
* an accurate result when `rank` is `0`, the value of the smallest observation.
102+
* an accurate result when `rank` is _n_-1, the value of the largest observation, where _n_ denotes the number of observations added to the sketch.
103+
* `inf` when `rank` is equal to _n_ or larger than _n_.
104+
* `nan` for all ranks when the given sketch is empty.
105+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: the given key does not exist or is of an incorrect type, rank parsing errors, or incorrect number of arguments.
106+
107+
{{< /multitabs >}}

content/commands/tdigest.byrevrank.md

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,49 +19,39 @@ categories:
1919
- kubernetes
2020
- clients
2121
complexity: O(N) where N is the number of reverse ranks specified.
22-
description: Returns, for each input reverse rank, an estimation of the value (floating-point)
22+
description: Returns, for each input reverse rank, an estimation of the floating-point value
2323
with that reverse rank
2424
group: tdigest
2525
hidden: false
2626
linkTitle: TDIGEST.BYREVRANK
2727
module: Bloom
2828
since: 2.4.0
2929
stack_path: docs/data-types/probabilistic
30-
summary: Returns, for each input reverse rank, an estimation of the value (floating-point)
30+
summary: Returns, for each input reverse rank, an estimation of the floating-point value
3131
with that reverse rank
3232
syntax_fmt: TDIGEST.BYREVRANK key reverse_rank [reverse_rank ...]
3333
syntax_str: reverse_rank [reverse_rank ...]
3434
title: TDIGEST.BYREVRANK
3535
---
36-
Returns, for each input reverse rank, an estimation of the value (floating-point) with that reverse rank.
37-
36+
Returns, for each input reverse rank (`revrank`), an estimation of the floating-point value with that reverse rank.
3837
Multiple estimations can be retrieved in a single call.
3938

4039
## Required arguments
4140

4241
<details open><summary><code>key</code></summary>
43-
is key name for an existing t-digest sketch.
42+
43+
is the key name of an existing t-digest sketch.
4444
</details>
4545

4646
<details open><summary><code>revrank</code></summary>
4747

48-
Reverse rank, for which the value should be retrieved.
48+
Reverse ranks for which the values should be retrieved.
4949

5050
0 is the reverse rank of the value of the largest observation.
5151

52-
_n_-1 is the reverse rank of the value of the smallest observation; _n_ denotes the number of observations added to the sketch.
52+
_n_-1 is the reverse rank of the value of the smallest observation, where _n_ denotes the number of observations added to the sketch.
5353
</details>
5454

55-
## Return value
56-
57-
[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) - an array of floating-points populated with value_1, value_2, ..., value_R:
58-
59-
- Return an accurate result when `revrank` is 0 (the value of the largest observation)
60-
- Return an accurate result when `revrank` is _n_-1 (the value of the smallest observation), where _n_ denotes the number of observations added to the sketch.
61-
- Return '-inf' when `revrank` is equal to _n_ or larger than _n_
62-
63-
All values are 'nan' if the sketch is empty.
64-
6555
## Examples
6656

6757
{{< highlight bash >}}
@@ -87,3 +77,31 @@ redis> TDIGEST.BYREVRANK t 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
8777
15) "1"
8878
16) "-inf"
8979
{{< / highlight >}}
80+
81+
## Return information
82+
83+
{{< multitabs id=“tdigest-byrevrank-return-info"
84+
tab1="RESP2"
85+
tab2="RESP3" >}}
86+
87+
One of the following:
88+
89+
* [Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk strings]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) as floating-points, populated with value_1, value_2, ..., value_R:
90+
* an accurate result when `rank` is `0`, the value of the largest observation.
91+
* an accurate result when `rank` is _n_-1, the value of the smallest observation, where _n_ denotes the number of observations added to the sketch.
92+
* `inf` when `rank` is equal to _n_ or larger than _n_.
93+
* `nan` for all ranks when the given sketch is empty.
94+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: the given key does not exist or is of an incorrect type, rank parsing errors, or an incorrect number of arguments.
95+
96+
-tab-sep-
97+
98+
One of the following:
99+
100+
* [Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [doubles]({{< relref "/develop/reference/protocol-spec#doubles" >}}) as floating-points, populated with value_1, value_2, ..., value_R:
101+
* an accurate result when `rank` is `0`, the value of the largest observation.
102+
* an accurate result when `rank` is _n_-1, the value of the smallest observation, where _n_ denotes the number of observations added to the sketch.
103+
* `inf` when `rank` is equal to _n_ or larger than _n_.
104+
* `nan` for all ranks when the given sketch is empty.
105+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: the given key does not exist or is of an incorrect type, rank parsing errors, or an incorrect number of arguments.
106+
107+
{{< /multitabs >}}

content/commands/tdigest.cdf.md

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ categories:
1919
- kubernetes
2020
- clients
2121
complexity: O(N) where N is the number of values specified.
22-
description: Returns, for each input value, an estimation of the fraction (floating-point)
22+
description: Returns, for each input value, an estimation of the floating-point fraction
2323
of (observations smaller than the given value + half the observations equal to the
2424
given value)
2525
group: tdigest
@@ -28,32 +28,27 @@ linkTitle: TDIGEST.CDF
2828
module: Bloom
2929
since: 2.4.0
3030
stack_path: docs/data-types/probabilistic
31-
summary: Returns, for each input value, an estimation of the fraction (floating-point)
31+
summary: Returns, for each input value, an estimation of the floating-point fraction
3232
of (observations smaller than the given value + half the observations equal to the
3333
given value)
3434
syntax_fmt: TDIGEST.CDF key value [value ...]
3535
syntax_str: value [value ...]
3636
title: TDIGEST.CDF
3737
---
38-
Returns, for each input value, an estimation of the fraction (floating-point) of (observations smaller than the given value + half the observations equal to the given value).
39-
38+
Returns, for each input value, an estimation of the floating-point fraction of (_observations smaller than the given value_ + _half the observations equal to the given value_).
4039
Multiple fractions can be retrieved in a single call.
4140

4241
## Required arguments
4342

4443
<details open><summary><code>key</code></summary>
45-
is key name for an existing t-digest sketch.
46-
</details>
4744

48-
<details open><summary><code>value</code></summary>
49-
is value for which the CDF (Cumulative Distribution Function) should be retrieved.
45+
is the key name for an existing t-digest sketch.
5046
</details>
5147

52-
## Return value
53-
54-
[Array reply]({{< relref "/develop/reference/protocol-spec#arrays" >}}) - the command returns an array of floating-points populated with fraction_1, fraction_2, ..., fraction_N.
48+
<details open><summary><code>value</code></summary>
5549

56-
All values are 'nan' if the sketch is empty.
50+
are the values for which the CDF (Cumulative Distribution Function) should be retrieved.
51+
</details>
5752

5853
## Examples
5954

@@ -71,3 +66,25 @@ redis> TDIGEST.CDF t 0 1 2 3 4 5 6
7166
6) "0.83333333333333337"
7267
7) "1"
7368
{{< / highlight >}}
69+
70+
## Return information
71+
72+
{{< multitabs id=“tdigest-cdf-return-info"
73+
tab1="RESP2"
74+
tab2="RESP3" >}}
75+
76+
One of the following:
77+
78+
* [Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [bulk string replies]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) as floating-points, populated with fraction_1, fraction_2, ..., fraction_N.
79+
All values are `nan` if the given sketch is empty.
80+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: the given key does not exist or is of an incorrect type, value parsing errors, or an incorrect number of arguments.
81+
82+
-tab-sep-
83+
84+
One of the following:
85+
86+
* [Array]({{< relref "/develop/reference/protocol-spec#arrays" >}}) of [doubles]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}})populated with fraction_1, fraction_2, ..., fraction_N.
87+
All values are `nan` if the given sketch is empty.
88+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: the given key does not exist or is of an incorrect type, value parsing errors, or an incorrect number of arguments.
89+
90+
{{< /multitabs >}}

content/commands/tdigest.create.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,40 @@ Allocates memory and initializes a new t-digest sketch.
3737
## Required arguments
3838

3939
<details open><summary><code>key</code></summary>
40-
is key name for this new t-digest sketch.
40+
41+
is the key name for this new t-digest sketch.
4142
</details>
4243

4344
## Optional arguments
4445

45-
<details open><summary><code>COMPRESSION compression</code></summary>
46-
47-
is a controllable tradeoff between accuracy and memory consumption. 100 is a common value for normal uses. 1000 is more accurate. If no value is passed by default the compression will be 100. For more information on scaling of accuracy versus the compression parameter see [_The t-digest: Efficient estimates of distributions_](https://www.sciencedirect.com/science/article/pii/S2665963820300403).
46+
<details open><summary><code>COMPRESSION compression</code></summary>
4847

48+
is a controllable tradeoff between accuracy and memory consumption. 100 is a common value for normal uses and also the default if not specified. 1000 is more accurate. For more information on scaling of accuracy versus the compression value see [_The t-digest: Efficient estimates of distributions_](https://www.sciencedirect.com/science/article/pii/S2665963820300403).
4949
</details>
50-
51-
## Return value
52-
53-
[Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) - `OK` if executed correctly, or [] otherwise.
5450

55-
## Examples
51+
## Example
5652

5753
{{< highlight bash >}}
5854
redis> TDIGEST.CREATE t COMPRESSION 100
5955
OK
6056
{{< / highlight >}}
57+
58+
## Return information
59+
60+
{{< multitabs id=“tdigest-create-return-info"
61+
tab1="RESP2"
62+
tab2="RESP3" >}}
63+
64+
One of the following:
65+
66+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) `OK` if executed correctly.
67+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: incorrect key type or incorrect keyword.
68+
69+
-tab-sep-
70+
71+
One of the following:
72+
73+
* [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) `OK` if executed correctly.
74+
* [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: incorrect key type or incorrect keyword.
75+
76+
{{< /multitabs >}}

0 commit comments

Comments
 (0)