beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [beam] youngoli commented on a change in pull request #11197: [BEAM-8292] Portable Reshuffle for Go SDK
Date Tue, 24 Mar 2020 04:20:55 GMT
youngoli commented on a change in pull request #11197: [BEAM-8292] Portable Reshuffle for Go
SDK
URL: https://github.com/apache/beam/pull/11197#discussion_r396823199
 
 

 ##########
 File path: sdks/go/pkg/beam/core/runtime/exec/coder.go
 ##########
 @@ -259,59 +298,82 @@ type customDecoder struct {
 	dec Decoder
 }
 
-func (c *customDecoder) Decode(r io.Reader) (*FullValue, error) {
+func (c *customDecoder) DecodeTo(r io.Reader, fv *FullValue) error {
 	// (1) Read length-prefixed encoded data
 
 	size, err := coder.DecodeVarInt(r)
 	if err != nil {
-		return nil, err
+		return err
 	}
 	data, err := ioutilx.ReadN(r, (int)(size))
 	if err != nil {
-		return nil, err
+		return err
 	}
 
 	// (2) Call decode
 
 	val, err := c.dec.Decode(c.t, data)
 	if err != nil {
+		return err
+	}
+	*fv = FullValue{Elm: val}
+	return err
 
 Review comment:
   I know this is just preserving the existing behavior, but it seems weird to `return err`
here instead of `return nil`, even if it is guaranteed to be `nil` at this point.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message