Repository navigation
fix: align empty Theta and Tuple seed hash handling - #283
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Empty compact Theta and Tuple sketches currently serialize their configured seed hash, so the empty image depends on its seed. Reading an empty image also exposes the stored fingerprint instead of the caller's, and legacy Theta v2 rejects empty images with zero or mismatched seed hashes.
Use canonical 8-byte images with a zero seed hash for empty serialization, including Theta's compressed fallback. Empty deserialization associates the result with the supplied seed; for example, reading the same empty bytes with seed 123 or 456 gives the corresponding in-memory fingerprint. Non-empty sketches still require a matching seed, including sampled sketches with no retained entries.
This aligns the wire encoding with apache/datasketches-java#772 and empty-v2 acceptance with Java's legacy reader. Rust objects retain the caller's seed fingerprint rather than Java's zero-valued empty-object fingerprint.
Validation:
cargo x check,cargo x test, andcargo x lint.