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

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

                Author: ASF GitHub Bot
            Created on: 11/Oct/21 18:53
            Start Date: 11/Oct/21 18:53
    Worklog Time Spent: 10m 
      Work Description: lostluck commented on a change in pull request #15703:
URL: https://github.com/apache/beam/pull/15703#discussion_r726503099



##########
File path: sdks/go/pkg/beam/core/graph/fn.go
##########
@@ -385,6 +385,12 @@ func AsDoFn(fn *Fn, numMainIn mainInputs) (*DoFn, error) {
 
        if _, ok := fn.methods[processElementName]; !ok {
                err := errors.Errorf("failed to find %v method", 
processElementName)
+               if fn.Recv != nil {
+                       v := reflect.ValueOf(fn.Recv)
+                       if v.Kind() != reflect.Ptr {
+                               err = errors.Wrap(err, "structural DoFn passed 
by value, ensure that ProcessElement method is value receiving or have DoFn 
passed by pointer")

Review comment:
       ```suggestion
                                err = errors.Wrap(err, "structural DoFn passed 
by value, ensure that the ProcessElement method has a value receiver or pass 
the DoFn by pointer")
   ```




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 663716)
    Time Spent: 0.5h  (was: 20m)

> Error unclear for structural DoFn
> ---------------------------------
>
>                 Key: BEAM-12960
>                 URL: https://issues.apache.org/jira/browse/BEAM-12960
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-go
>            Reporter: Andrew Haselgrove
>            Assignee: Jack McCluskey
>            Priority: P2
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> I recently received the following error for my structural DoFn: "failed to 
> find ProcessElement method". However, I had implemented ProcessElement - the 
> error was that I failed to take the address of the DoFn struct as the 
> parameter for the ParDo.
> I think this error could be much clearer. Taking a look at the 
> implementation, I see that it somewhat is: 
> [https://github.com/apache/beam/blob/master/sdks/go/pkg/beam/core/graph/fn.go#L154.]
>  However, this error message doesn't match the implementation, which also 
> accepts the struct as-is. I assume the struct is accepted here for other uses 
> of `NewFn` (eg. `RegisterFunction`), as from my example above, for the 
> `ParDo` case, this just goes on to surface a less-clear error deeper in the 
> call chain.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to