tisonkun commented on PR #299: URL: https://github.com/apache/datasketches-rust/pull/299#issuecomment-6707876008
Addressed the three review points in separate commits: 1. **Empty inputs** ([review](https://github.com/apache/datasketches-rust/pull/299#issuecomment-6705240877), [1229545](https://github.com/apache/datasketches-rust/commit/122954518c045df3808aac5ea81bc08761ff4d51)): version 2 now ignores zero-byte item encodings before validating weight or changing counters. Estimates and both bounds return zero for these inputs, even when the corresponding hash would collide with populated counters. The regression covers empty `raw_bytes` strings and slices, plus `()`. Since the API accepts `Hash`, the rule also applies to custom implementations that write no bytes. Version 1 retains its existing behavior. The private adapter is named `ItemHasher`, with comments explaining the encoding requirements and why empty input must be tracked separately from the hash result. 2. **Integer widening** ([review](https://github.com/apache/datasketches-rust/pull/299#issuecomment-6705240877), [5588bbc](https://github.com/apache/datasketches-rust/commit/5588bbc192b40d2e7a92c24baeb91aa79b81ab24)): added the eight `Hasher` overrides so narrow signed/unsigned integers and `isize`/`usize` use the same little-endian 64-bit encoding as their widened values. The existing encoding test now exercises these paths, including negative signed inputs and unsigned maxima. 3. **Examples and contracts** ([review](https://github.com/apache/datasketches-rust/pull/299#issuecomment-6705251288), [1a3c3ee](https://github.com/apache/datasketches-rust/commit/1a3c3eecdcc8f9354d30c09cbe92e6a0939a7dd8)): examples now use `i64` items or `raw_bytes` strings. Public documentation describes the input and compatibility contracts, and the changelog and PR description reflect the final behavior. No public API was added. Bare strings and slices still require `raw_bytes` for portable encoding; the generic `Hash` API cannot infer the original item type from its encoded bytes. The empty-input and integer-widening regressions failed before their respective fixes and pass now. Validation: `cargo x check`, all 821 tests via `cargo x test`, `cargo x lint`, and all 7 Count-Min benchmark smoke scenarios via `cargo x bench -- countmin --test`. -- 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]
