tisonkun opened a new pull request, #247:
URL: https://github.com/apache/datasketches-rust/pull/247
## Summary
This PR hardens the crate as a public library rather than expanding its
algorithm surface:
- replace configuration- and composition-dependent panics with typed
`Result` errors in Bloom, Count-Min, and CPC APIs;
- reject invalid or unattainable sizing inputs instead of silently coercing
them, and make frequent-items sizing helpers use the same units as its
constructor;
- simplify the exposed surface by making T-Digest precision explicit,
supporting immutable T-Digest persistence, colocating Jaccard result types, and
removing test-only or private-storage leaks;
- make Count-Min and frequent-items overflow behavior deterministic through
saturating arithmetic, and add reusable reset paths for Count-Min and mutable
T-Digest workloads;
- document algorithm selection and the distinction between serialization
compatibility and cross-language hashing compatibility;
- replace a 10-million-update CPC test with a focused Sliding-flavor
regression and update the yanked `chacha20` lockfile entry.
The intentional breaking changes and migration paths are listed in
`CHANGELOG.md`.
## Review guide
The 23 commits are intentionally scoped to one concern each. A useful review
order is the existing commit order:
1. test cost and the T-Digest empty-split regression;
2. fallible Bloom, Count-Min, and CPC composition APIs;
3. sizing validation and frequent-items configuration units;
4. T-Digest persistence/deserialization ergonomics and public-surface
cleanup;
5. reusable reset APIs and crate-level usage guidance;
6. arithmetic/accuracy boundary handling, CPC diagnostic documentation, and
lockfile hygiene.
No commit combines an unrelated cleanup with a behavior change.
## Notable API migrations
- `BloomFilter::{union, intersect}`, `CountMinSketch::merge`, and
`CpcUnion::update` now return `Result`.
- Bloom sizing helpers and `CpcSketch::max_serialized_bytes` now return
`Result`.
- `FrequentItemsSketch::{epsilon_for_max_map_size, apriori_error}` accept
maximum map sizes rather than logarithmic sizes; `max_map_size` exposes the
configured value.
- `TDigestMut::deserialize(bytes, is_f32)` is split into
`deserialize(bytes)` and `deserialize_f32(bytes)`; immutable `TDigest` now has
matching persistence methods.
- `JaccardSimilarity` is imported from `theta` or `tuple`; internal
diagnostic/storage types are no longer exported.
## Validation
- `cargo x check`
- `cargo x test` (including cross-language serialization fixtures and 135
doctests)
- `cargo x lint`
- `cargo package --package datasketches` using an isolated target directory
- focused debug and release regression coverage for frequent-items saturation
## Deliberate non-goals
This does not introduce a new hashing trait or value-update abstraction;
that broader design remains part of #127. It also does not change estimator
mathematics, add algorithms, or make a `no_std` claim. The scope is the
caller-visible contracts and maintenance issues that can be improved without
preempting those designs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]