zetasketch_rs/lib.rs
1// SPDX-FileCopyrightText: 2025 Daniel Vrátil <me@dvratil.cz>
2//
3// SPDX-License-Identifier: MIT
4//
5// Based on the original Zetasketch implementation by Google:
6// https://github.com/google/zetasketch
7// Published under the Apache License 2.0
8
9//! This crate provides fully compatible re-implementation of the
10//! [ZetaSketch Java library](https://github.com/google/zetasketch) from Google in Rust.
11//!
12//! The ZetaSketch library contains implementation of the HyperLogLog++ algorithm as
13//! used by various Google Cloud products, such as BigQuery and BigTable. You can use
14//! this crate to decode and encode the HyperLogLog++ sketches in a way that is fully
15//! compatible with the implementation in BigQuery and BigTable.
16//!
17//! This crate strives to be a 100% compatible re-implementation of the original Java
18//! library and any deviation from the behavior of the Java library is considered to
19//! be a bug.
20//!
21//! ## Usage
22//!
23//! To decode an existing sketch, you can use [`HyperLogLogPlusPlus::from_bytes`].
24//! To create a branch new sketch, you can use the [`HyperLogLogPlusPlusBuilder`].
25//! See documentation for each of the classes for more details.
26
27mod fingerprint2011;
28
29mod aggregator;
30mod error;
31mod hll;
32mod hyperloglogplusplus;
33pub mod protos;
34pub(crate) mod utils;
35
36pub use aggregator::Aggregator;
37pub use error::SketchError;
38pub use hyperloglogplusplus::{HyperLogLogPlusPlus, HyperLogLogPlusPlusBuilder};