tisonkun opened a new pull request, #361:
URL: https://github.com/apache/datasketches-rust/pull/361

   ## Problem
   
   `CountMinSketch` supports both legacy version 1 serialized images and 
current version 2 sketches, and `CountMinSketch::merge` rejects mixing serial 
versions or mismatched sketch parameters. Previously, callers had no public way 
to inspect a deserialized sketch's serial version or check configuration and 
format compatibility before attempting a merge, nor did `Debug` output surface 
the serial version. In addition, `CountMinSketch::suggest_num_buckets` and 
`CountMinSketch::suggest_num_hashes` did not note that individually valid 
suggestions can exceed the combined `num_hashes * num_buckets < 1_073_741_824` 
table entry limit when passed together to `new` or `with_seed`.
   
   ## Changes
   
   - Expose `CountMinSketch::serial_version(&self) -> u8` (`#[must_use]`) 
returning `1` for restored version 1 images and `2` for newly constructed or 
version 2 sketches.
   - Expose `CountMinSketch::is_compatible(&self, other: &Self) -> bool` 
(`#[must_use]`) checking `num_hashes`, `num_buckets`, `seed`, and 
`serial_version`, matching `BloomFilter::is_compatible`, and document that 
`merge` can still fail with `InvalidArgument` if combined `total_weight` 
overflows `T::MAX`.
   - Reuse `self.is_compatible(other)` inside `CountMinSketch::merge`.
   - Include `serial_version` in `fmt::Debug for CountMinSketch<T>`.
   - Clarify on `CountMinSketch::suggest_num_buckets` and 
`CountMinSketch::suggest_num_hashes` that individually valid suggestions can 
exceed `num_hashes * num_buckets < 1_073_741_824` when combined in 
`CountMinSketch::new` or `CountMinSketch::with_seed`.
   - Add integration and serialization tests covering `serial_version`, 
`is_compatible` across all four compatibility dimensions, weight-overflow edge 
cases, and oversized suggestion combinations, and update `CHANGELOG.md`.
   
   ## Validation
   
   - `cargo x check`
   - `cargo +1.86.0 check -p datasketches --all-features`
   - `cargo x test`
   - `cargo x lint`
   - `RUSTDOCFLAGS="-D warnings" cargo doc --package datasketches 
--all-features --no-deps`
   


-- 
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]

Reply via email to