Skip to main content

hyperunique-druid

Decode, merge and estimate Apache Druid hyperUnique sketches (org.apache.druid.hll, version 1 wire format -- not DataSketches HLL). A from-scratch Rust port of Druid 30.0.0's HyperLogLogCollector, with optional Python bindings (PyO3) and a ready-made ClickHouse executable-UDF loop.

Distributed as a PyPI package (hyperunique-druid): abi3 wheels for CPython

= 3.9, Rust inside. Not published to crates.io -- the Rust API is internal to the wheel.

Rust (inside the wheel)

use hyperunique_druid::hyperunique::merge_estimate;

let estimate: f64 = merge_estimate(&[sketch_a.as_slice(), sketch_b.as_slice()])?;

hyperunique::{decode, fold, estimate} are there for finer control.

Python

import hyperunique_druid

hyperunique_druid.merge_estimate([sketch_a, sketch_b])  # float; 0.0 for []
hyperunique_druid.serve()  # ClickHouse RowBinary UDF loop over stdin/stdout

serve() runs the whole read/merge/write loop natively with the GIL released, so a ClickHouse Cloud UDF is just:

# main.py
import hyperunique_druid

hyperunique_druid.serve()
# requirements.txt
hyperunique-druid==0.1.0

Layout

Cargo.toml / pyproject.toml   one crate, built by cargo (Rust) or maturin (Python)
src/hyperunique.rs            the sketch logic
src/rowbinary.rs, src/udf.rs  ClickHouse RowBinary framing + UDF loop
src/python.rs                 PyO3 bindings (feature `python`)
python/hyperunique_druid/     Python package wrapping the `_native` extension
package.sh                    builds everything publishable into dist/
verify-wheels.sh              smoke-tests every Linux wheel in containers

Develop

cargo test                       # Rust tests (no Python needed)
uv venv && uvx maturin develop   # build + install into .venv

Release

  1. Bump version in Cargo.toml (the Python version is read from it too). Fill in license and repository there on the first release.

  2. ./package.sh -- runs the tests and writes to dist/: manylinux2014 (glibc) and musllinux_1_2 (musl) wheels for linux x86_64 and aarch64, plus a native wheel for local use. Requires rustup and uv.

  3. ./verify-wheels.sh -- installs each Linux wheel into real containers (glibc + musl, amd64 + arm64, Python 3.9 + 3.13) and runs it. Requires podman or docker.

  4. Upload (versions are permanent; set MATURIN_PYPI_TOKEN first):

    uvx maturin upload dist/*linux*.whl
    
  5. Pin the new version in udfs/hyperunique-merge-pyo3/requirements.txt.

pip picks the matching wheel, so Cloud's platform doesn't need to be known. Other platforms (armv7, ppc64le, ...) would need a target added to package.sh; there is deliberately no sdist, so those get pip's clear "no matching distribution" error instead of a failed Rust build.

Metadata

Release files for hyperunique-druid 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for hyperunique-druid 0.1.0
File
hyperunique_druid-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details
hyperunique_druid-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details
hyperunique_druid-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details
hyperunique_druid-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details

Total release size: 797.4 kB

Release files / hyperunique_druid-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL hyperunique_druid-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl
Size 202.1 kB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
b16ddb990dc66c73e43757aba1388d5d35c0ed6688e394f8bac3dbf40ec0b5f8
BLAKE2b-256 checksum
How to use checksums
b80d1f3208d80829c79abecce8ec4aad3e348c619d8c4cec02718bed9ee933de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / hyperunique_druid-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL hyperunique_druid-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl
Size 195.3 kB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
86e41e91027dc301c62747cb9e0a919c014d8fbf72b08cef29a1d760fb609468
BLAKE2b-256 checksum
How to use checksums
9babb17dc64c1930967557836083e1e866bd150b0faf800cd8b22d669673d241
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / hyperunique_druid-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL hyperunique_druid-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 203.5 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
1126be1b9f57c93f5541eb5c0327eff85cbd1efa1da89d98dc493a3d11c2a651
BLAKE2b-256 checksum
How to use checksums
c2c81b9dbc56c712e7f16b0f154d8ba0f368fd3215f8171377202ed6a597e73c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / hyperunique_druid-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL hyperunique_druid-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 196.5 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
de7ed2241e08f4b15d527d0672b9a7a6ea3f13a3dec18d8b6109ddfff50ff04e
BLAKE2b-256 checksum
How to use checksums
14c343af588388cc86cf64e6fa516f03bb36701f71cf17401feb577c2357665c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.1.1

2 release files

This release

0.1.0 This release

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page