PSeitz / sketches-rust

Rust implementation of DDSketch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sketches-rust

This is a partial port of the Java DDSketch quantile implementation writen by Rust. DDSketch is mergeable, meaning that multiple sketches from distributed systems can be combined in a central node.

Features

It aims at as compatible as possible with Java implementations, here is some features has support:

  • CubicallyInterpolatedMapping
  • LogarithmicMapping
  • CollapsingHighestDense
  • CollapsingLowestDense
  • UnboundedSizeDenseStore
  • Mergeable
  • Decode from input
  • Encode to output

Usage

let mut d = DDSketch::collapsing_lowest_dense(0.02, 100).unwrap();
d.accept(1.0);
d.accept(2.0);
d.accept(3.0);
assert_eq!(d.get_count(), 3.0);
println!("{}", d.get_max().unwrap());
println!("{}", d.get_min().unwrap());
println!("{}", d.get_sum().unwrap());
println!("{}", d.get_average().unwrap());

About

Rust implementation of DDSketch

License:Apache License 2.0


Languages

Language:Rust 100.0%