lostluck commented on a change in pull request #15639:
URL: https://github.com/apache/beam/pull/15639#discussion_r721474478



##########
File path: sdks/go/pkg/beam/core/runtime/harness/statecache/statecache.go
##########
@@ -21,25 +21,45 @@
 package statecache
 
 import (
+       "io"
        "sync"
 
+       "github.com/apache/beam/sdks/v2/go/pkg/beam/core/typex"
        "github.com/apache/beam/sdks/v2/go/pkg/beam/internal/errors"
        fnpb "github.com/apache/beam/sdks/v2/go/pkg/beam/model/fnexecution_v1"
 )
 
 type token string
 
-// ReusableInput is a resettable value, notably used to unwind iterators 
cheaply
-// and cache materialized side input across invocations.
+// FullValue represents the full runtime value for a data element, incl. the
+// implicit context. The result of a GBK or CoGBK is not a single FullValue.
+// The consumer is responsible for converting the values to the correct type.
+// To represent a nested KV with FullValues, assign a *FullValue to Elm/Elm2.
 //
-// Redefined from exec's input.go to avoid a cyclical dependency.
-type ReusableInput interface {
-       // Init initializes the value before use.
-       Init() error
-       // Value returns the side input value.
-       Value() interface{}
-       // Reset resets the value after use.
-       Reset() error
+// Copied from exec/fullvalue.go to avoid cyclical dependencies.
+type FullValue struct {
+       Elm  interface{} // Element or KV key.
+       Elm2 interface{} // KV value, if not invalid
+
+       Timestamp typex.EventTime
+       Windows   []typex.Window
+       Pane      typex.PaneInfo
+}
+
+// Stream is a FullValue reader. It returns io.EOF when complete, but can be
+// prematurely closed.
+//
+// Copied from exec/fullvalue.go to prevent cyclical dependencies.
+type Stream interface {
+       io.Closer
+       Read() (*FullValue, error)

Review comment:
       Interface types with the same method sets will be identical. However, 
structs with the same fields are not identical, though they are assignable to 
each other.
   
   So the problem is FullValue is a struct type, which means the two different 
Stream types are returning different types, and that means the method isn't the 
same, making the Stream type not the same, making the Restream type not the 
same.
   
   Subtle: yes.
   
   ResuableInput didn't have this problem because it just returned interface{} 
or error.




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