Skip to content

Commit 8aeecb9

Browse files
authored
docs: expand README and prepare 0.4.0 changelog (#199)
1 parent 035c977 commit 8aeecb9

2 files changed

Lines changed: 81 additions & 15 deletions

File tree

CHANGELOG.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,29 @@ All significant changes to this project will be documented in this file.
77
### Breaking changes
88

99
* Move the `hash_value` module to `hash::value`.
10-
* Remove `ThetaSketch::builder`, `ThetaUnion::builder`, and `TupleSketch::builder`. Construct `ThetaSketchBuilder`, `ThetaUnionBuilder`, and `TupleSketchBuilder` with `Default::default` instead.
11-
* Standardize Theta and Tuple set-operation constructors. Zero-configuration operators use
12-
`Default::default()`, `TupleIntersection::new(policy)` uses the default seed, and `with_seed`
13-
accepts a custom seed. This replaces the previous `new(seed)` and `new_with_default_seed`
14-
methods.
10+
* Rename `Coupon::from_hash` to `Coupon::from_value` to reflect that the method hashes the supplied value itself.
11+
* Remove `ThetaSketch::builder`; construct `ThetaSketchBuilder` with `Default::default` instead.
12+
* Replace the sealed `ThetaSketchView` trait with a concrete borrowed `ThetaSketchView<'a>`. Call `as_view()` when a view value is needed; Theta set operations continue to accept references to mutable and compact sketches directly.
13+
* Change `ThetaSketch` and `CompactThetaSketch` iterators to yield `ThetaEntry` instead of raw `u64` hashes. Call `ThetaEntry::hash` to access a retained hash.
14+
* Replace `ThetaIntersection::new(seed)` and `new_with_default_seed()` with `with_seed(seed)` and `Default::default()`, respectively. Replace `result()` and `result_with_ordered(ordered)` with `to_sketch(ordered)`.
15+
* Make `CountMinValue` and `UnsignedCountMinValue` marker traits. Their previously exposed numeric constants and helper methods have been removed; use the corresponding primitive integer operations and conversions directly.
1516

1617
### New features
1718

19+
* Add Tuple sketches behind the `tuple` feature, including custom summary update and combination policies, serialization, compact sketches, union, intersection, A-not-B, Jaccard similarity, and exact sketch-state equality checks that ignore summary values.
20+
* Add Theta union, A-not-B, Jaccard similarity, and exact sketch-state equality checks.
1821
* `FrequentItemsSketch` now supports borrowed-key updates via `update_ref` and `update_with_count_ref`, allowing sketches such as `FrequentItemsSketch<String>` to update from `&str` without allocating on existing-key hits. Frequency queries also accept borrowed key forms matching `Borrow<Q>`.
1922
* `FrequentItemsSketch` no longer requires item types to implement `Clone` for core updates, queries, and serialization. Custom `FrequentItemValue` implementations can now be non-`Clone`; APIs that return or merge owned items still require `Clone`.
20-
* `CountMinSketch` and `FrequentItemsSketch` now expose `estimated_size()`, reporting the in-memory footprint of the sketch in bytes, following the other sketches.
21-
* The stateful set operations `HllUnion`, `CpcUnion`, `ThetaUnion`, `ThetaIntersection`, `TupleUnion`, and `TupleIntersection` now expose `estimated_size()`, reporting the in-memory footprint of the operator's internal state in bytes.
23+
* Add `estimated_size()` to `BloomFilter`, `CountMinSketch`, `CpcSketch`, `FrequentItemsSketch`, `HllSketch`, `TDigestMut`, `TDigest`, mutable and compact Theta and Tuple sketches, and the stateful `HllUnion`, `CpcUnion`, `ThetaUnion`, `ThetaIntersection`, `TupleUnion`, and `TupleIntersection` operators.
2224

2325
### Bug fixes
2426

27+
* HLL serialization now emits the compact auxiliary-map flag required for Java to read HLL4 images and matches Java and C++ coupon ordering for compact Set images.
2528
* `FrequentItemsSketch::serialize` now writes the full 8-byte preamble for an empty sketch, matching the Java and C++ encoding. Empty sketches previously serialized to 6 bytes, which `FrequentItemsSketch::deserialize` rejected with an insufficient-data error.
29+
* `FrequentItemsSketch` now preserves total weight and error state across serialization and merge when a purge removes every active item.
30+
* T-Digest interpolation now keeps quantiles finite for extreme finite inputs. Deserialization rejects non-finite extrema, invalid centroid weights, and total-weight overflow as invalid data instead of allowing invalid state or panicking.
31+
* Legacy Theta version 2 exact images with retained entries now deserialize as non-empty sketches and preserve their entries and exact estimates.
32+
* Bloom filter deserialization now rejects inconsistent cached bit counts, preventing malformed images from hiding populated bits and violating the no-false-negative guarantee.
2633
* `CpcSketch` and `CpcWrapper` now classify out-of-range fields in serialized images as `InvalidData` rather than `InvalidArgument`.
2734

2835
## v0.3.0 (2026-05-18)

README.md

Lines changed: 67 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,74 @@
3535
[actions-badge]: https://github.com/apache/datasketches-rust/actions/workflows/ci.yml/badge.svg
3636
[actions-url]: https://github.com/apache/datasketches-rust/actions/workflows/ci.yml
3737

38-
This is the core Rust component of the DataSketches library. It contains a subset of the sketching algorithms and can be accessed directly from user applications.
38+
Apache DataSketches Rust provides stochastic streaming algorithms for answering queries over large data sets with compact, mergeable summaries. It is the core Rust component of Apache DataSketches and currently implements a subset of the algorithms available in the other language components.
3939

40-
Note that we have parallel core library components for Java, C++, Python, and Go implementations of many of the same sketch algorithms:
40+
## Getting started
4141

42-
- [datasketches-java](https://github.com/apache/datasketches-java)
43-
- [datasketches-cpp](https://github.com/apache/datasketches-cpp)
44-
- [datasketches-python](https://github.com/apache/datasketches-python)
45-
- [datasketches-go](https://github.com/apache/datasketches-go)
42+
Sketch implementations are opt-in Cargo features; the crate enables none by default. For example, add the HyperLogLog implementation with:
4643

47-
Please visit the main [DataSketches website](https://datasketches.apache.org) for more information.
44+
```shell
45+
cargo add datasketches --features hll
46+
```
4847

49-
If you are interested in making contributions to this site, please see our [Community](https://datasketches.apache.org/docs/Community/) page for how to contact us.
48+
Then build a sketch and query its distinct-count estimate:
49+
50+
```rust
51+
use datasketches::hll::HllSketch;
52+
use datasketches::hll::HllType;
53+
54+
let mut sketch = HllSketch::new(12, HllType::Hll8);
55+
for user in ["alice", "bob", "alice", "carol"] {
56+
sketch.update(user);
57+
}
58+
59+
assert!(sketch.estimate() >= 3.0);
60+
```
61+
62+
Enable multiple algorithms by listing their features together, such as `features = ["hll", "theta"]` in `Cargo.toml`.
63+
64+
## Available sketches
65+
66+
| Feature | Main types | Use case |
67+
| --- | --- | --- |
68+
| `bloom` | `BloomFilter` | Space-efficient probabilistic set membership with a configurable false-positive rate. |
69+
| `countmin` | `CountMinSketch` | Approximate point-frequency queries over a stream. |
70+
| `cpc` | `CpcSketch`, `CpcUnion`, `CpcWrapper` | Highly compact distinct-count estimation and unions. |
71+
| `frequencies` | `FrequentItemsSketch` | Heavy-hitter discovery with upper and lower frequency bounds. |
72+
| `hll` | `HllSketch`, `HllUnion` | Fast distinct-count estimation and unions. |
73+
| `tdigest` | `TDigestMut`, `TDigest` | Quantile and rank estimation, with high accuracy near distribution tails. |
74+
| `theta` | `ThetaSketch` and set operations | Distinct counts, set expressions, and Jaccard similarity. |
75+
| `tuple` | `TupleSketch` and set operations | Theta-style keys with user-defined summaries attached to retained entries. |
76+
77+
See the [API documentation](https://docs.rs/datasketches) for configuration, accuracy guarantees, serialization, and examples for each algorithm.
78+
79+
## Compatibility
80+
81+
The minimum supported Rust version is 1.86.0. The crate currently supports little-endian targets only.
82+
83+
Supported serialization formats are tested with fixtures produced by Apache DataSketches Java, C++, and Go through the [DataSketches TCK](https://github.com/apache/datasketches-tck). When values must hash identically across language implementations, use the compatibility wrappers in `hash::value`.
84+
85+
See the [changelog](CHANGELOG.md) for release notes and migration guidance.
86+
87+
## Other language implementations
88+
89+
Apache DataSketches also provides core library components for other languages:
90+
91+
- [Java](https://github.com/apache/datasketches-java)
92+
- [C++](https://github.com/apache/datasketches-cpp)
93+
- [Python](https://github.com/apache/datasketches-python)
94+
- [Go](https://github.com/apache/datasketches-go)
95+
96+
Visit the [Apache DataSketches website](https://datasketches.apache.org) for algorithm documentation, research background, and project-wide resources.
97+
98+
## Community and contributing
99+
100+
Questions, bug reports, and feature requests are welcome through [GitHub issues](https://github.com/apache/datasketches-rust/issues) and [GitHub discussions](https://github.com/apache/datasketches-rust/discussions). The [Apache DataSketches community page](https://datasketches.apache.org/docs/Community/) lists the public mailing lists and other ways to participate.
101+
102+
See [CONTRIBUTING.md](CONTRIBUTING.md) to build, test, and contribute to the Rust component. All project participation is governed by the [Apache Software Foundation Code of Conduct](https://www.apache.org/foundation/policies/conduct.html).
103+
104+
To report a security vulnerability, follow the [ASF security reporting process](https://www.apache.org/security/) instead of opening a public issue.
105+
106+
## License
107+
108+
Licensed under the [Apache License, Version 2.0](LICENSE).

0 commit comments

Comments
 (0)