damccorm commented on code in PR #22935:
URL: https://github.com/apache/beam/pull/22935#discussion_r958497941


##########
sdks/go/test/integration/primitives/state.go:
##########
@@ -385,3 +386,47 @@ func MapStateParDo() *beam.Pipeline {
 
        return p
 }
+
+type setStateFn struct {
+       State1 state.Set[string]
+}
+
+func (f *setStateFn) ProcessElement(s state.Provider, w string, c int) string {
+       ok, err := f.State1.Contains(s, w)
+       if err != nil {
+               panic(err)
+       }
+       err = f.State1.Add(s, w)
+       if err != nil {
+               panic(err)
+       }
+       if ok {
+               err = f.State1.Add(s, fmt.Sprintf("%v%v", w, 1))
+               if err != nil {
+                       panic(err)
+               }
+       }
+
+       keys, _, err := f.State1.Keys(s)
+       if err != nil {
+               panic(err)
+       }
+
+       sort.Slice(keys, func(i, j int) bool { return keys[i] < keys[j] })
+
+       return fmt.Sprintf("%v: %v, keys: %v", w, ok, keys)
+}
+
+// MapStateParDo tests a DoFn that uses value state.

Review Comment:
   Oop, good catch!



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