This is an automated email from the ASF dual-hosted git repository. notfilippo pushed a commit to branch filippo.rossi/push-yoruxxvzvuqm in repository https://gitbox.apache.org/repos/asf/datasketches-rust.git
commit 0810c99edcd514b94e3250f4f74992fdbf20fa02 Author: Filippo Rossi <[email protected]> AuthorDate: Wed May 13 17:22:28 2026 +0200 fix(hll): preserve set coupon order when serializing Compact HLL Set serialization used to sort retained coupons before writing bytes. Java and C++ write compact Set coupons in hash table iteration order. Write the existing iterator output directly. This keeps the compact format and removes the extra allocation. --- datasketches/src/hll/hash_set.rs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/datasketches/src/hll/hash_set.rs b/datasketches/src/hll/hash_set.rs index b1d2bfb..d2c6efb 100644 --- a/datasketches/src/hll/hash_set.rs +++ b/datasketches/src/hll/hash_set.rs @@ -179,17 +179,7 @@ impl HashSet { // Write coupons if compact { - // Compact mode: collect non-empty coupons and sort for deterministic output - let mut coupons_vec: Vec<Coupon> = self - .container - .coupons - .iter() - .filter(|&&c| !c.is_empty()) - .copied() - .collect(); - coupons_vec.sort_unstable(); - - for coupon in coupons_vec.iter().copied() { + for coupon in self.container.iter() { bytes.write_u32_le(coupon.raw()); } } else { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
