youngoli commented on a change in pull request #11179: [BEAM-3301] Bugfix in 
DoFn validation.
URL: https://github.com/apache/beam/pull/11179#discussion_r395850295
 
 

 ##########
 File path: sdks/go/pkg/beam/core/graph/fn.go
 ##########
 @@ -446,23 +444,16 @@ func validateMainInputs(fn *Fn, method *funcx.Fn, 
methodName string, numMainIn m
                return err
        }
 
-       // Check that the first numMainIn inputs are not side inputs (Iters or
-       // ReIters). We aren't able to catch singleton side inputs here since
-       // they're indistinguishable from main inputs.
-       mainInputs := method.Param[pos : pos+int(numMainIn)]
-       for i, p := range mainInputs {
-               if p.Kind != funcx.FnValue {
-                       err := errors.Errorf("expected main input parameter but 
found "+
-                               "side input parameter in position %v",
-                               pos+i)
-                       err = errors.SetTopLevelMsgf(err,
-                               "Method %v in DoFn %v should have all main 
inputs before side inputs, "+
-                                       "but a side input (as Iter or ReIter) 
appears as parameter %v when a "+
-                                       "main input was expected.",
-                               methodName, fn.Name(), pos+i)
-                       err = errors.WithContextf(err, "method %v", methodName)
-                       return err
-               }
+       // Check that the first input is not an Iter or ReIter (those aren't 
valid
+       // as the first main input).
+       first := method.Param[pos].Kind
+       if first != funcx.FnValue {
+               err := errors.New("first main input parameter must be value 
type")
 
 Review comment:
   I'll just add it in real quick while squashing the commits.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to