Skip to main content

apache_datasketches/hll/
mod.rs

1//! HyperLogLog (HLL) cardinality estimation.
2//!
3//! ```
4//! # fn main() -> Result<(), apache_datasketches::SketchError> {
5//! use apache_datasketches::hll::{HllSketch, TargetHllType};
6//!
7//! let mut sketch = HllSketch::new(12, TargetHllType::Hll4)?;
8//! sketch.update_str("some-key");
9//! sketch.update_u64(42);
10//! println!("estimate: {}", sketch.get_estimate());
11//! # Ok(())
12//! # }
13//! ```
14//!
15//! [`HllUnion`] merges multiple sketches into one, e.g. combining
16//! per-shard/per-day counts into a total distinct count.
17
18mod sketch;
19mod union;
20
21pub use sketch::{HllSketch, TargetHllType};
22pub use union::HllUnion;