{"id":46202676,"url":"https://github.com/thanos/ex_data_sketch","last_synced_at":"2026-04-02T10:55:58.248Z","repository":{"id":341390771,"uuid":"1169944539","full_name":"thanos/ex_data_sketch","owner":"thanos","description":"Production-grade streaming data sketching algorithms for Elixir.","archived":false,"fork":false,"pushed_at":"2026-03-03T04:26:59.000Z","size":170,"stargazers_count":1,"open_issues_count":9,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-03T06:47:53.907Z","etag":null,"topics":["big-data","data-algorithms","data-sketches","data-sketching","elixir","probabilistic-programming","probalistic-data-structures"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thanos.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-01T13:21:25.000Z","updated_at":"2026-03-03T04:26:50.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/thanos/ex_data_sketch","commit_stats":null,"previous_names":["thanos/ex_data_sketch"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/thanos/ex_data_sketch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thanos%2Fex_data_sketch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thanos%2Fex_data_sketch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thanos%2Fex_data_sketch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thanos%2Fex_data_sketch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thanos","download_url":"https://codeload.github.com/thanos/ex_data_sketch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thanos%2Fex_data_sketch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30467878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-13T11:00:43.441Z","status":"ssl_error","status_checked_at":"2026-03-13T11:00:23.173Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["big-data","data-algorithms","data-sketches","data-sketching","elixir","probabilistic-programming","probalistic-data-structures"],"created_at":"2026-03-03T05:00:38.891Z","updated_at":"2026-04-02T10:55:58.225Z","avatar_url":"https://github.com/thanos.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ExDataSketch\n\nProduction-grade streaming data sketching algorithms for Elixir.\n\nExDataSketch provides probabilistic data structures for approximate counting,\nfrequency estimation, quantile computation, heavy-hitter detection, membership\ntesting with deletion, and set reconciliation on streaming data. All sketch\nstate is stored as Elixir-owned binaries, enabling straightforward\nserialization, distribution, and persistence.\n\n[![CI](https://github.com/thanos/ex_data_sketch/actions/workflows/ci.yml/badge.svg)](https://github.com/thanos/ex_data_sketch/actions/workflows/ci.yml)\n[![Hex version](https://img.shields.io/hexpm/v/ex_data_sketch.svg)](https://hex.pm/packages/ex_data_sketch)\n[![Hex docs](https://img.shields.io/badge/docs-hexdocs.pm-blue)](https://hexdocs.pm/ex_data_sketch)\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n\n\n## Supported Algorithms\n\n| Algorithm | Purpose | Status |\n|-----------|---------|--------|\n| HyperLogLog (HLL) | Cardinality estimation | Implemented (Pure + Rust) |\n| Count-Min Sketch (CMS) | Frequency estimation | Implemented (Pure + Rust) |\n| Theta Sketch | Set operations on cardinalities | Implemented (Pure + Rust) |\n| KLL Quantiles | Rank and quantile estimation | Implemented (Pure + Rust) |\n| DDSketch | Relative-error quantile estimation | Implemented (Pure + Rust) |\n| FrequentItems (SpaceSaving) | Heavy-hitter / top-k detection | Implemented (Pure + Rust) |\n| Bloom Filter | Probabilistic membership testing | Implemented (Pure + Rust) |\n| Cuckoo Filter | Membership testing with deletion | Implemented (Pure + Rust) |\n| Quotient Filter | Membership with deletion and merge | Implemented (Pure + Rust) |\n| CQF (Counting Quotient) | Multiset membership with counting | Implemented (Pure + Rust) |\n| XorFilter | Static immutable membership testing | Implemented (Pure + Rust) |\n| IBLT | Set reconciliation | Implemented (Pure + Rust) |\n| REQ Sketch | Relative-error quantile estimation | Implemented (Pure) |\n| Misra-Gries | Deterministic heavy-hitter detection | Implemented (Pure) |\n| UltraLogLog (ULL) | Improved cardinality estimation | Implemented (Pure + Rust) |\n\n### Capability Matrix\n\n| Structure | insert | delete | merge | count | serialize | static | reconciliation |\n|-----------|--------|--------|-------|-------|-----------|--------|----------------|\n| Bloom | yes | -- | yes | yes* | yes | -- | -- |\n| Cuckoo | yes | yes | -- | yes | yes | -- | -- |\n| Quotient | yes | yes | yes | yes | yes | -- | -- |\n| CQF | yes | yes | yes | yes | yes | -- | -- |\n| XorFilter | -- | -- | -- | yes | yes | yes | -- |\n| IBLT | yes | yes | yes | yes | yes | -- | yes |\n\n*Bloom count is a popcount-based cardinality estimate.\n\n### When to Choose\n\n- **Bloom** -- Default choice for membership testing. No deletion needed, mergeable.\n- **Cuckoo** -- Need to delete items. Better space efficiency than Bloom at low FPR.\n- **Quotient** -- Need deletion and merge. Good when filter resizing may be needed.\n- **CQF** -- Need to count how many times each item was inserted (multiset).\n- **XorFilter** -- Static set known at build time. Smallest footprint, fastest lookups.\n- **IBLT** -- Need to find differences between two sets (reconciliation).\n\n## Installation\n\nAdd `ex_data_sketch` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:ex_data_sketch, \"~\u003e 0.7.1\"}\n  ]\nend\n```\n\n## Quick Start\n\n```elixir\n# HLL: count distinct elements\nhll = ExDataSketch.HLL.new() |\u003e ExDataSketch.HLL.update_many(1..100_000)\nExDataSketch.HLL.estimate(hll)  # ~100_000\n\n# KLL: quantile estimation\nkll = ExDataSketch.KLL.new() |\u003e ExDataSketch.KLL.update_many(1..100_000)\nExDataSketch.KLL.quantile(kll, 0.5)   # approximate median (~50_000)\nExDataSketch.KLL.quantile(kll, 0.99)  # 99th percentile (~99_000)\n\n# Bloom: membership testing\nbloom = ExDataSketch.Bloom.new(capacity: 100_000)\nbloom = ExDataSketch.Bloom.put_many(bloom, 1..50_000)\nExDataSketch.Bloom.member?(bloom, 42)      # true\nExDataSketch.Bloom.member?(bloom, 99_999)  # false (probably)\n\n# Cuckoo: membership testing with deletion\ncuckoo = ExDataSketch.Cuckoo.new(capacity: 100_000)\n{:ok, cuckoo} = ExDataSketch.Cuckoo.put(cuckoo, \"user_42\")\nExDataSketch.Cuckoo.member?(cuckoo, \"user_42\")  # true\n{:ok, cuckoo} = ExDataSketch.Cuckoo.delete(cuckoo, \"user_42\")\nExDataSketch.Cuckoo.member?(cuckoo, \"user_42\")  # false\n```\n\nSee the [Quick Start Guide](guides/quick_start.md) for more examples.\n\n## Documentation\n\nFull documentation is available at [HexDocs](https://hexdocs.pm/ex_data_sketch).\n\n## Architecture\n\n- **Binary state**: All sketch state is canonical Elixir binaries. No opaque NIF resources.\n- **Backend system**: Pure Elixir reference implementation with optional Rust NIF acceleration. The Rust backend falls back to Pure automatically when unavailable.\n- **Serialization**: ExDataSketch-native format (EXSK) for all sketches, plus Apache DataSketches CompactSketch interop for Theta.\n- **Deterministic hashing**: Stable 64-bit hash (`ExDataSketch.Hash`) for reproducible results.\n- **Backend parity**: Both backends produce byte-identical serialized output for the same inputs.\n\n## Compatibility and Stability\n\nThe following guarantees apply within the v0.x release series:\n\n- **EXSK serialization**: The ExDataSketch-native binary format is stable. Binaries produced by any v0.x release can be deserialized by any other v0.x release.\n- **Pure vs Rust parity**: Given identical inputs, both backends produce byte-identical serialized state and identical estimates.\n- **Deterministic output**: The same input sequence always produces the same sketch state and estimate, regardless of backend.\n\nNot guaranteed:\n\n- **Cross-language interop**: Only Theta supports Apache DataSketches CompactSketch format. HLL and CMS DataSketches interop is not implemented.\n- **Performance stability**: Benchmark results may vary across hardware and OTP versions.\n- **EXSK format across major versions**: The binary format may change in future major releases.\n\n## Development\n\n```bash\n# Get dependencies\nmix deps.get\n\n# Run tests with coverage\nmix test --cover\n\n# Run lints\nmix lint\n\n# Run benchmarks\nmix bench\n\n# Generate docs\nmix docs\n```\n\n## Roadmap\n\n| Version | Focus | Status |\n|---------|-------|--------|\n| v0.1.0 | Core sketches (HLL, CMS, Theta) + Rust NIFs | Released |\n| v0.2.0 | KLL quantiles | Released |\n| v0.2.1 | DDSketch relative-error quantiles | Released |\n| v0.3.0 | FrequentItems (SpaceSaving) | Released |\n| v0.4.0 | Bloom filter (membership testing) | Released |\n| v0.5.0 | Advanced membership filters (Cuckoo, Quotient, CQF, XorFilter, IBLT, FilterChain) | Released |\n| v0.6.0 | REQ sketch, Misra-Gries, XXHash3, Rust NIF parity for all membership filters | Released |\n| v0.7.0 | ULL (UltraLogLog) -- improved cardinality estimation with Pure + Rust NIF | Released |\n| v0.7.1 | NIF batch hashing, hash customization, quotient filter fix, merge safety | Released |\n| v0.8.0 | Massive Static Data \u0026 Industry Interop -- Binary Fuse Filters, Ribbon Filter, Apache DataSketches Interop | Planned |\n| v0.9.0 | Dequantized HLL and Sphinx (Succinct Perfect Hash Index) | Planned |\n\n## License\n\nMIT License. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthanos%2Fex_data_sketch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthanos%2Fex_data_sketch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthanos%2Fex_data_sketch/lists"}