[ 
https://issues.apache.org/jira/browse/BEAM-3306?focusedWorklogId=194335&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-194335
 ]

ASF GitHub Bot logged work on BEAM-3306:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 05/Feb/19 00:26
            Start Date: 05/Feb/19 00:26
    Worklog Time Spent: 10m 
      Work Description: lostluck commented on pull request #7723: [BEAM-3306] 
Add first pass coder registry for Go
URL: https://github.com/apache/beam/pull/7723#discussion_r253699708
 
 

 ##########
 File path: sdks/go/pkg/beam/coder.go
 ##########
 @@ -27,6 +27,18 @@ import (
        "github.com/golang/protobuf/proto"
 )
 
+type jsonCoder interface {
+       json.Marshaler
+       json.Unmarshaler
+}
+
+var protoMessageType = reflect.TypeOf((*proto.Message)(nil)).Elem()
+var jsonCoderType = reflect.TypeOf((*jsonCoder)(nil)).Elem()
+
+func init() {
+       coder.RegisterCoder(protoMessageType, protoEnc, protoDec)
+}
 
 Review comment:
   The Go SDK currently uses JSON encoding by default in absence of any other 
coder. There's a bit of special case code to catch/break arbitrary interface 
types that are not JSON marshall-able, but long term, I think beam is moving in 
the schema direction, which would become the new default coder. 
   In principle the proto coding shouldn't even be in this package, and it 
should be some kind of x package folks can _ import to get it. However, there 
are a few places to clean up in the package that depend on /hack in this 
behavior via Protocol buffers, and we need to clean those up before I make that 
breaking change.
 
----------------------------------------------------------------
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: 194335)
    Time Spent: 1h 20m  (was: 1h 10m)

> 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
>          Time Spent: 1h 20m
>  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)

Reply via email to