tisonkun opened a new issue, #321: URL: https://github.com/apache/datasketches-rust/issues/321
## Problem Tuple union serialization currently requires `union.to_sketch(ordered).serialize()`. `to_sketch()` clones retained entries, including each user-defined summary. For summaries containing heap data, this may allocate and copy substantial data that serialization only needs to borrow. The summary encoder itself already accepts `&self`. ## Suggested approach - Add direct union-result serialization that borrows summaries while applying the final theta, capacity, and ordering rules. - For ordered output or capacity selection, consider sorting/selecting references to entries instead of cloning summary values. Share result preparation and encoding with the compact sketch where appropriate. - Keep the existing `TupleSummaryValue` encoding contract. Avoid adding a `Clone` bound solely for serialization; this does not imply removing the cloning requirements of union updates. - Begin with `TupleUnion`. Evaluate reuse for `TupleIntersection` and mutable-sketch compaction/serialization as follow-ups. Preserve the distinction between an uninitialized intersection and an empty result. Start with `datasketches/src/thetafamily/tuple/union.rs`, `tuple/sketch.rs`, `tuple/serialization.rs`, and `common/union.rs`. Coordinate changes to shared Theta-family result preparation with the Theta serialization work. PR #317 provides the corresponding HLL motivation. ## Validation Compare with the existing compact-result path across ordering choices, theta/capacity trimming, empty/singleton results, and fixed- and variable-size summaries. Exercise summary encoding and subsequent merges with a realistic heap-backed summary. Verify existing compatibility tests and measure time and allocations for both small numeric summaries and larger heap-backed summaries before claiming a performance gain. Follow CONTRIBUTING.md for changelog entries, integration-test placement, serialization fixtures, and the required checks. -- 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]
