[
https://issues.apache.org/jira/browse/BEAM-3306?focusedWorklogId=198350&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-198350
]
ASF GitHub Bot logged work on BEAM-3306:
----------------------------------------
Author: ASF GitHub Bot
Created on: 13/Feb/19 21:59
Start Date: 13/Feb/19 21:59
Worklog Time Spent: 10m
Work Description: lostluck commented on pull request #7834: [BEAM-3306]
Encapsulate coder details.
URL: https://github.com/apache/beam/pull/7834
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:
var t reflect.Type // from some where
coder := beam.NewCoder(typex.New(t))
enc := exec.MakeElementEncoder(beam.UnwrapCoder(coder))
var buf bytes.Buffer
err := enc.Encode(exec.FullValue{Elm: value}, &buf)
...
This required users to access beam implementation details directly:
coder.Coder, the typex package, the exec package & the FullValue type.
Following this PR:
var t reflect.Type // from somewhere
enc := beam.NewElementEncoder(t)
var buf bytes.Buffer
err := enc.Encode(value, &buf)
...
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
similar appropriately for beam themselves, rather than via the framework,
however at that point.
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:
- [ ] [**Choose
reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and
mention them in a comment (`R: @username`).
- [ ] Format the pull request title like `[BEAM-XXX] Fixes bug in
ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA
issue, if applicable. This will automatically link the pull request to the
issue.
- [ ] If this contribution is large, please file an Apache [Individual
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
Post-Commit Tests Status (on master branch)
------------------------------------------------------------------------------------------------
Lang | SDK | Apex | Dataflow | Flink | Gearpump | Samza | Spark
--- | --- | --- | --- | --- | --- | --- | ---
Go | [](https://builds.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/)
| --- | --- | --- | --- | --- | ---
Java | [](https://builds.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/)
| [](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex/lastCompletedBuild/)
| [](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/)
| [](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/)<br>[](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/)<br>[](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/)
| [](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump/lastCompletedBuild/)
| [](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/)
| [](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/)
Python | [](https://builds.apache.org/job/beam_PostCommit_Python_Verify/lastCompletedBuild/)
| --- | [](https://builds.apache.org/job/beam_PostCommit_Py_VR_Dataflow/lastCompletedBuild/)
</br> [](https://builds.apache.org/job/beam_PostCommit_Py_ValCont/lastCompletedBuild/)
| [](https://builds.apache.org/job/beam_PreCommit_Python_PVR_Flink_Cron/lastCompletedBuild/)
| --- | --- | ---
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 198350)
Time Spent: 2.5h (was: 2h 20m)
> Consider: Go coder registry
> ---------------------------
>
> Key: BEAM-3306
> URL: https://issues.apache.org/jira/browse/BEAM-3306
> Project: Beam
> Issue Type: Improvement
> Components: sdk-go
> Reporter: Henning Rohde
> Assignee: Robert Burke
> Priority: Minor
> Labels: triaged
> Time Spent: 2.5h
> Remaining Estimate: 0h
>
> Add coder registry to allow easier overwrite of default coders. We may also
> allow otherwise un-encodable types, but that would require that function
> analysis depends on it.
> If we're hardcoding support for proto/avro, then there may be little need for
> such a feature. Conversely, this may be how we implement such support.
>
> Proposal Doc:
> [https://docs.google.com/document/d/1kQwx4Ah6PzG8z2ZMuNsNEXkGsLXm6gADOZaIO7reUOg/edit#|https://docs.google.com/document/d/1kQwx4Ah6PzG8z2ZMuNsNEXkGsLXm6gADOZaIO7reUOg/edit]
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)