[BEAM-3306] Encapsulate coder details. #7834
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change encapsulates internal implementation details that most users should not need.
In particular: This CL removes needing to wrap values in the exec.FullValue type before encoding them. It also hides the internal coder.Coder abstraction.
Previously users needed to do the following to use a beam coder to encode an element of a given type:
This required users to access beam implementation details directly: coder.Coder, the typex package, the exec package & the FullValue type.
Following this PR:
which doesn't leak such details. Similarly for the Decoders.
This PR makes the breaking change of removing the beam.UnwrapCoder method. There is an open question of whether users will ever need to encode KVs, or CoGBKs or similar themselves, rather than via the framework, at which point we can revisit this.
TODO in a later PR: allow users to register coders that implement beam.ElementEncoder and beam.ElementDecoder.
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username).[BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replaceBEAM-XXXwith the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.Post-Commit Tests Status (on master branch)