pub trait TDigestCommands<'a> {
Show 14 methods // Provided methods fn tdigest_add( self, key: impl SingleArg, values: impl SingleArgCollection<f64> ) -> PreparedCommand<'a, Self, ()> where Self: Sized { ... } fn tdigest_byrank<R: CollectionResponse<f64>>( self, key: impl SingleArg, ranks: impl SingleArgCollection<usize> ) -> PreparedCommand<'a, Self, R> where Self: Sized { ... } fn tdigest_byrevrank<R: CollectionResponse<f64>>( self, key: impl SingleArg, ranks: impl SingleArgCollection<usize> ) -> PreparedCommand<'a, Self, R> where Self: Sized { ... } fn tdigest_cdf<V: SingleArg, R: CollectionResponse<f64>>( self, key: impl SingleArg, values: impl SingleArgCollection<V> ) -> PreparedCommand<'a, Self, R> where Self: Sized { ... } fn tdigest_create( self, key: impl SingleArg, compression: Option<i64> ) -> PreparedCommand<'a, Self, ()> where Self: Sized { ... } fn tdigest_info( self, key: impl SingleArg ) -> PreparedCommand<'a, Self, TDigestInfoResult> where Self: Sized { ... } fn tdigest_max(self, key: impl SingleArg) -> PreparedCommand<'a, Self, f64> where Self: Sized { ... } fn tdigest_merge<S: SingleArg>( self, destination: impl SingleArg, sources: impl SingleArgCollection<S>, options: TDigestMergeOptions ) -> PreparedCommand<'a, Self, ()> where Self: Sized { ... } fn tdigest_min(self, key: impl SingleArg) -> PreparedCommand<'a, Self, f64> where Self: Sized { ... } fn tdigest_quantile<Q: SingleArg, R: CollectionResponse<f64>>( self, key: impl SingleArg, quantiles: impl SingleArgCollection<Q> ) -> PreparedCommand<'a, Self, R> where Self: Sized { ... } fn tdigest_rank<V: SingleArg, R: CollectionResponse<isize>>( self, key: impl SingleArg, values: impl SingleArgCollection<V> ) -> PreparedCommand<'a, Self, R> where Self: Sized { ... } fn tdigest_reset(self, key: impl SingleArg) -> PreparedCommand<'a, Self, ()> where Self: Sized { ... } fn tdigest_revrank<V: SingleArg, R: CollectionResponse<isize>>( self, key: impl SingleArg, values: impl SingleArgCollection<V> ) -> PreparedCommand<'a, Self, R> where Self: Sized { ... } fn tdigest_trimmed_mean( self, key: impl SingleArg, low_cut_quantile: f64, high_cut_quantile: f64 ) -> PreparedCommand<'a, Self, f64> where Self: Sized { ... }
}
Available on crate feature redis-bloom only.
Expand description

A group of Redis commands related to T-Digest

See Also

T-Digest Commands

Provided Methods§

source

fn tdigest_add( self, key: impl SingleArg, values: impl SingleArgCollection<f64> ) -> PreparedCommand<'a, Self, ()>
where Self: Sized,

Adds one or more observations to a t-digest sketch.

Arguments
  • key - key name for an existing t-digest sketch.
  • values - collection values of an observation (floating-point).
See Also
source

fn tdigest_byrank<R: CollectionResponse<f64>>( self, key: impl SingleArg, ranks: impl SingleArgCollection<usize> ) -> PreparedCommand<'a, Self, R>
where Self: Sized,

Returns, for each input rank, an estimation of the value (floating-point) with that rank.

Multiple estimations can be retrieved in a single call.

Arguments
  • key - key name for an existing t-digest sketch.
  • ranks - collection of ranks, for which the value should be retrieved.
    • 0 - is the rank of the value of the smallest observation.
    • n-1 - is the rank of the value of the largest observation; n denotes the number of observations added to the sketch.
Return

a collection of floating-points populated with value_1, value_2, …, value_R:

  • Return an accurate result when rank is 0 (the value of the smallest observation)
  • 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.
  • Return inf when rank is equal to n or larger than n
See Also
source

fn tdigest_byrevrank<R: CollectionResponse<f64>>( self, key: impl SingleArg, ranks: impl SingleArgCollection<usize> ) -> PreparedCommand<'a, Self, R>
where Self: Sized,

Returns, for each input reverse rank, an estimation of the value (floating-point) with that reverse rank.

Multiple estimations can be retrieved in a single call.

Arguments
  • key - key name for an existing t-digest sketch.
  • ranks - collection of reverse ranks, for which the value should be retrieved.
    • 0 - is the reverse rank of the value of the largest observation.
    • n-1 - s the reverse rank of the value of the smallest observation; n denotes the number of observations added to the sketch.
Return

a collection of floating-points populated with value_1, value_2, …, value_R:

  • Return an accurate result when revrank is 0 (the value of the largest observation)
  • 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.
  • Return ‘inf’ when revrank is equal to n or larger than n
See Also
source

fn tdigest_cdf<V: SingleArg, R: CollectionResponse<f64>>( self, key: impl SingleArg, values: impl SingleArgCollection<V> ) -> PreparedCommand<'a, Self, R>
where Self: Sized,

Returns, for each input reverse rank, an estimation of the value (floating-point) with that reverse rank.

Multiple estimations can be retrieved in a single call.

Arguments
Return

a collection of floating-points populated with fraction_1, fraction_2, …, fraction_N.

All values are nan if the sketch is empty.

See Also
source

fn tdigest_create( self, key: impl SingleArg, compression: Option<i64> ) -> PreparedCommand<'a, Self, ()>
where Self: Sized,

Allocates memory and initializes a new t-digest sketch.

Arguments
  • key - key name for this new t-digest sketch.
  • compression - 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.
See Also
source

fn tdigest_info( self, key: impl SingleArg ) -> PreparedCommand<'a, Self, TDigestInfoResult>
where Self: Sized,

Returns information and statistics about a t-digest sketch

Arguments
  • key - key name for an existing t-digest sketch.
Return

An instance of TDigestInfoResult

See Also
source

fn tdigest_max(self, key: impl SingleArg) -> PreparedCommand<'a, Self, f64>
where Self: Sized,

Returns the maximum observation value from a t-digest sketch.

Arguments
  • key - key name for an existing t-digest sketch.
Return

maximum observation value from a sketch. The result is always accurate. nan if the sketch is empty.

See Also
source

fn tdigest_merge<S: SingleArg>( self, destination: impl SingleArg, sources: impl SingleArgCollection<S>, options: TDigestMergeOptions ) -> PreparedCommand<'a, Self, ()>
where Self: Sized,

Merges multiple t-digest sketches into a single sketch.

Arguments
  • destination - key name for a t-digest sketch to merge observation values to.
    • If destination not exist, a new sketch is created.
    • If destination is an existing sketch, its values are merged with the values of the source keys.
      To override the destination key contents use override.
  • sources - collection of key names for t-digest sketches to merge observation values from.
See Also
source

fn tdigest_min(self, key: impl SingleArg) -> PreparedCommand<'a, Self, f64>
where Self: Sized,

Returns the minimum observation value from a t-digest sketch.

Arguments
  • key - key name for an existing t-digest sketch.
Return

minimum observation value from a sketch. The result is always accurate. nan if the sketch is empty.

See Also
source

fn tdigest_quantile<Q: SingleArg, R: CollectionResponse<f64>>( self, key: impl SingleArg, quantiles: impl SingleArgCollection<Q> ) -> PreparedCommand<'a, Self, R>
where Self: Sized,

Returns, for each input fraction, an estimation of the value (floating point) that is smaller than the given fraction of observations.

Multiple quantiles can be retrieved in a signle call.

Arguments
  • key - key name for an existing t-digest sketch.
  • quantiles - collection of quantiles which are input fractions (between 0 and 1 inclusively)
Return

a collection of estimates (floating-point) populated with value_1, value_2, …, value_N.

  • Return an accurate result when quantile is 0 (the value of the smallest observation)
  • Return an accurate result when quantile is 1 (the value of the largest observation)

All values are nan if the sketch is empty.

See Also
source

fn tdigest_rank<V: SingleArg, R: CollectionResponse<isize>>( self, key: impl SingleArg, values: impl SingleArgCollection<V> ) -> PreparedCommand<'a, Self, R>
where Self: Sized,

Returns, for each input value (floating-point), the estimated rank of the value (the number of observations in the sketch that are smaller than the value + half the number of observations that are equal to the value).

Multiple ranks can be retrieved in a signle call.

Arguments
  • key - key name for an existing t-digest sketch.
  • values - collection of values for which the rank should be estimated.
Return

a collection of integers populated with rank_1, rank_2, …, rank_V:

  • -1 - when value is smaller than the value of the smallest observation.
  • The number of observations - when value is larger than the value of the largest observation.
  • Otherwise: an estimation of the number of (observations smaller than value + half the observations equal to value).

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

n-1 is the rank of the value of the largest observation; n denotes the number of observations added to the sketch.

All values are -2 if the sketch is empty.

See Also
source

fn tdigest_reset(self, key: impl SingleArg) -> PreparedCommand<'a, Self, ()>
where Self: Sized,

Resets a t-digest sketch: empty the sketch and re-initializes it.

Arguments
  • key - key name for an existing t-digest sketch.
See Also
source

fn tdigest_revrank<V: SingleArg, R: CollectionResponse<isize>>( self, key: impl SingleArg, values: impl SingleArgCollection<V> ) -> PreparedCommand<'a, Self, R>
where Self: Sized,

Returns, for each input value (floating-point), the estimated reverse rank of the value (the number of observations in the sketch that are smaller than the value + half the number of observations that are equal to the value).

Multiple reverse ranks can be retrieved in a signle call.

Arguments
  • key - key name for an existing t-digest sketch.
  • values - collection of values for which the reverse rank should be estimated.
Return

a collection of integers populated with revrank_1, revrank_2, …, revrank_V:

  • -1 - when value is smaller than the value of the smallest observation.
  • The number of observations - when value is larger than the value of the largest observation.
  • Otherwise: an estimation of the number of (observations smaller than value + half the observations equal to value).

0 is the reverse rank of the value of the smallest observation.

n-1 is the reverse rank of the value of the largest observation; n denotes the number of observations added to the sketch.

All values are -2 if the sketch is empty.

See Also
source

fn tdigest_trimmed_mean( self, key: impl SingleArg, low_cut_quantile: f64, high_cut_quantile: f64 ) -> PreparedCommand<'a, Self, f64>
where Self: Sized,

Returns an estimation of the mean value from the sketch, excluding observation values outside the low and high cutoff quantiles.

Arguments
  • key - key name for an existing t-digest sketch.
  • low_cut_quantile - Foating-point value in the range [0..1], should be lower than high_cut_quantile
    When equal to 0: No low cut.
    When higher than 0: Exclude observation values lower than this quantile.
  • high_cut_quantile - Floating-point value in the range [0..1], should be higher than low_cut_quantile
    When lower than 1: Exclude observation values higher than or equal to this quantile.
    When equal to 1: No high cut.
Return

estimation of the mean value. ‘nan’ if the sketch is empty.

See Also

Implementors§

source§

impl<'a> TDigestCommands<'a> for &'a Client

source§

impl<'a> TDigestCommands<'a> for &'a mut Transaction

source§

impl<'a, 'b> TDigestCommands<'a> for &'a mut Pipeline<'b>