tisonkun opened a new pull request, #283: URL: https://github.com/apache/datasketches-rust/pull/283
Empty compact Theta and Tuple sketches currently serialize their configured seed hash, so an empty sketch's bytes depend on its seed instead of using the canonical zero seed hash. With the default seed, the final two bytes of the 8-byte image are `cc 93` instead of `00 00`. Related to https://github.com/apache/datasketches-java/pull/772, specifically its empty `CompactTupleSketch` seed-hash fix. Rust has the same serialization gap in both Tuple and Theta, so this PR fixes both. The Bloom test, Maven configuration, and t-digest changes in that Java PR are outside this change. | Default-seed empty image | Before | After | | --- | --- | --- | | Theta | `01 03 03 00 00 1e cc 93` | `01 03 03 00 00 1e 00 00` | | Tuple | `01 03 09 01 00 1e cc 93` | `01 03 09 01 00 1e 00 00` | Both serializers now write zero only when `is_empty()` is true. Theta's `serialize_compressed()` also uses this encoding for empty sketches through its existing uncompressed fallback. Non-empty sketches keep their seed hashes and mismatch validation, including sampled sketches that retain no entries. This normalizes serialized output; it does not fix an estimation error or a failure to read the new Java format. Readers already accept empty images with zero or nonzero seed hashes. Older Rust images remain readable and are normalized on reserialization. The change does not mutate the sketch being serialized. Validation: - Added regression tests that compare default-seed and custom-seed empty output byte-for-byte with the pinned C++ snapshots; both failed before the fix and pass afterward. - Covered reading and normalizing older nonzero-seed-hash empty images, Theta's compressed fallback, and preservation of seed validation for non-empty sketches with zero retained entries. - `cargo x check` - `cargo x test` - `cargo x lint` -- 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]
