A Rust library for estimating quantiles in a stream, using ClickHouse t-digest data structure.
The t-digest data structure is designed around computing accurate quantile estimates from streaming data. Two t-digests can be merged, making the data structure well suited for map-reduce settings.
use tdigest_ch::TDigest;
let mut digest = TDigest::new();
// Add some elements.
digest.insert(1.0);
digest.insert(2.0);
digest.insert(3.0);
// Get the median of the distribution.
let quantile = digest.quantile(0.5);
assert_eq!(quantile, 2.0);