You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by lo...@apache.org on 2019/11/06 00:48:42 UTC
[beam] 01/01: [Go SDK] Correctly return EOFs from boolDecoder
This is an automated email from the ASF dual-hosted git repository.
lostluck pushed a commit to branch lostluck-patch-2
in repository https://gitbox.apache.org/repos/asf/beam.git
commit 6237a92025becc167fffe9ed7dcac51930a1eabf
Author: Robert Burke <lo...@users.noreply.github.com>
AuthorDate: Tue Nov 5 16:48:29 2019 -0800
[Go SDK] Correctly return EOFs from boolDecoder
The io.EOF is a special error that's looked for upstream to know that the stream ended normally.
---
sdks/go/pkg/beam/core/runtime/exec/coder.go | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sdks/go/pkg/beam/core/runtime/exec/coder.go b/sdks/go/pkg/beam/core/runtime/exec/coder.go
index 0ef7260..1224774 100644
--- a/sdks/go/pkg/beam/core/runtime/exec/coder.go
+++ b/sdks/go/pkg/beam/core/runtime/exec/coder.go
@@ -181,6 +181,9 @@ func (*boolDecoder) Decode(r io.Reader) (*FullValue, error) {
// Encoding: false = 0, true = 1
b := make([]byte, 1, 1)
if err := ioutilx.ReadNBufUnsafe(r, b); err != nil {
+ if err == io.EOF {
+ return nil, err
+ }
return nil, fmt.Errorf("error decoding bool: %v", err)
}
switch b[0] {