This is an automated email from the ASF dual-hosted git repository.

lostluck pushed a commit to branch lostluck-patch-1
in repository https://gitbox.apache.org/repos/asf/beam.git

commit 3606d506d64bf1f83438cb9616d9b7fa45dccd10
Author: Robert Burke <lostl...@users.noreply.github.com>
AuthorDate: Thu Sep 5 13:55:30 2019 -0700

    [GoSDK] Improve singleton side input runtime error
    
    The Runtime Error message left a bit to be desired. The main thing that's 
missing for these runtime errors is how to localize this better WRT where in 
the pipeline graph it's being used (eg. Scope hierarchy or similar), but many 
DoFns are 1 off, so this might be sufficient.
    
    Before:
    making side input 0:
            singleton side input Singleton for *flumego_test_go_proto.KV 
ill-defined
    
    making side input 0 for fully/qualified/path/to/dofn/create.sideKV:
            got 2 values, want one value for Singleton side input of type 
*flumego_test_go_proto.KV
---
 sdks/go/pkg/beam/core/runtime/exec/fn.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sdks/go/pkg/beam/core/runtime/exec/fn.go 
b/sdks/go/pkg/beam/core/runtime/exec/fn.go
index b6c479c..1211989 100644
--- a/sdks/go/pkg/beam/core/runtime/exec/fn.go
+++ b/sdks/go/pkg/beam/core/runtime/exec/fn.go
@@ -265,7 +265,7 @@ func makeSideInputs(fn *funcx.Fn, in []*graph.Inbound, side 
[]ReStream) ([]Reusa
        for i := 0; i < len(side); i++ {
                s, err := makeSideInput(in[i+1].Kind, 
fn.Param[param[i+offset]].T, side[i])
                if err != nil {
-                       return nil, errors.WithContextf(err, "making side input 
%v", i)
+                       return nil, errors.WithContextf(err, "making side input 
%v for %v", i, fn)
                }
                ret = append(ret, s)
        }
@@ -303,7 +303,7 @@ func makeSideInput(kind graph.InputKind, t reflect.Type, 
values ReStream) (Reusa
                        return nil, err
                }
                if len(elms) != 1 {
-                       return nil, errors.Errorf("singleton side input %v for 
%v ill-defined", kind, t)
+                       return nil, errors.Errorf("got %d values, want one 
value for %v side input of type %v", len(elms), graph.Singleton, t)
                }
                return &fixedValue{val: Convert(elms[0].Elm, t)}, nil
 

Reply via email to