lukecwik commented on a change in pull request #15191:
URL: https://github.com/apache/beam/pull/15191#discussion_r673433028



##########
File path: sdks/go/pkg/beam/core/runtime/exec/sdf_invokers_test.go
##########
@@ -382,3 +382,50 @@ func (fn *VetKvSdf) ProcessElement(rt *VetRTracker, i, j 
int, emit func(*VetRest
        rest.ProcessElm = true
        emit(rest)
 }
+
+// VetEmptyInitialSplitSdf runs an SDF in order to test that these methods get 
called properly,
+// each method will flip the corresponding flag in the passed in 
VetRestriction,
+// overwrite the restriction's Key and Val with the last seen input elements,
+// and retain the other fields in the VetRestriction.
+type VetEmptyInitialSplitSdf struct {

Review comment:
       That looks so convenient but was unable to get it to work since the 
ProcessElement method was not being found.
   
   Code I used was:
   ```
   // VetEmptyInitialSplitSdf runs an SDF in order to test that these methods 
get called properly,
   // each method will flip the corresponding flag in the passed in 
VetRestriction,
   // overwrite the restriction's Key and Val with the last seen input elements,
   // and retain the other fields in the VetRestriction.
   type VetEmptyInitialSplitSdf struct {
     sdf *VetSdf `default:"{}"`
   }
   
   // SplitRestriction outputs zero restrictions.
   func (fn *VetEmptyInitialSplitSdf) SplitRestriction(i int, rest 
*VetRestriction) []*VetRestriction {
        return []*VetRestriction{}
   }
   ```
   
   Error I got was:
   ```
   === RUN   TestSdfNodes
   
   --- FAIL: TestSdfNodes (0.00s)
   
       sdf_test.go:62: invalid function:        graph.AsDoFn: for Fn named 
github.com/apache/beam/sdks/go/pkg/beam/core/runtime/exec.VetEmptyInitialSplitSdf
   
           failed to find ProcessElement method
   ```
   Will merge as-is. Using the type embedding seems very convenient to have.




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


Reply via email to