apache / apache/beam

Combine API to increase safety when accumulator is mutated

Open
#20,369 0 comments 0 reactions 0 assignees View on GitHub
core java new feature P3
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

Combine docs for e.g. `mergeAccumulators` say

"only the first accumulator may be modified and returned for efficiency; the other accumulators should not be mutated, because they may be shared with other code and mutating them could lead to incorrect results or data corruption."

This is fine, but the API is odd: `AccumT mergeAccumulators(Iterable accumulators)` implies that all accumulators are treated equally.

It has been suggested to create a new one more like `AccumT mergeAccumulators(AccumT mutable, Iterable immutableAccums)`

Imported from Jira [BEAM-10326](https://issues.apache.org/jira/browse/BEAM-10326). Original Jira may contain additional context.
Reported by: kenn.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.