sliortega295-ops opened a new pull request, #39921:
URL: https://github.com/apache/beam/pull/39921
## Summary
- reuse the first `ApproximateUnique` accumulator instead of allocating an
empty heap and reinserting every sampled hash
- preserve the empty-iterable behavior and leave later accumulators unchanged
- add merge identity, result, non-mutation, and empty-input coverage
- document the improvement in `CHANGES.md`
This brings the Python merge path in line with the existing Java
implementation and removes one accumulator's worth of heap insertions from
every merge.
Fixes #19459.
## Validation
- `pytest apache_beam/transforms/stats_test.py`: 87 passed with the source
implementation
- rebuilt the Python extensions, then reran the same suite: 87 passed
- focused new merge tests: 2 passed in both source and extension-backed runs
- Ruff, YAPF, and `git diff --check`: passed
- CPU microbenchmark, two identical full accumulators (median of 101 runs):
- sample size 1,600: 0.6172 ms -> 0.2158 ms (2.86x)
- sample size 10,000: 3.9099 ms -> 1.3734 ms (2.85x)
No GPU was used or required.
## AI disclosure
The implementation, tests, benchmark, and this description were generated
with OpenAI Codex at the account owner's request. Codex re-checked the final
diff against the repository code and ran the validations listed above. No
separate human line-by-line code review was performed before submission.
--
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]