Renkai opened a new pull request, #177: URL: https://github.com/apache/datasketches-rust/pull/177
Follow-up of #174, addressing part of #137. While all sketch types expose `estimated_size()` now, the stateful set-operation operators — which hold real heap state while accumulating updates — don't report their footprint yet. This patch adds `estimated_size()` to: - `HllUnion` — delegates to its internal `HllSketch` gadget - `CpcUnion` — covers both internal states (`Accumulator` sketch and `BitMatrix`) - `ThetaUnion` / `ThetaIntersection` — via a heap-only helper on `UnionState` / `IntersectionState` - `TupleUnion` / `TupleIntersection` — same shared helpers The a-not-b operators are stateless (a one-shot computation over two inputs), so they are intentionally exempt. Implementation notes: - `UnionState::estimated_size()` / `IntersectionState::estimated_size()` report heap allocations only (delegating to `SketchHashTable::estimated_size()`), so the public operators can compose `size_of::<Self>() + state.estimated_size()` without double counting. - For `HllUnion` and `CpcUnion`, whose state embeds a full sketch inline, the inner sketch's inline size is subtracted for the same reason. Note that an operator's footprint cannot be inferred from its result sketch: the internal table keeps capacity headroom per its load factor and resize history (and `CpcUnion`'s bit matrix is fixed at `k * 8` bytes), whereas `to_sketch()` produces a tightly packed copy. Tests: one case per operator in the existing integration targets. Verified with `cargo x check`, `cargo x test` (incl. Go snapshots), and `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]
