damccorm commented on a change in pull request #16775:
URL: https://github.com/apache/beam/pull/16775#discussion_r801914322



##########
File path: sdks/go/pkg/beam/core/runtime/exec/sideinput.go
##########
@@ -43,26 +43,71 @@ type sideInputAdapter struct {
        kc          ElementEncoder
        ec          ElementDecoder
        wm          WindowMapper
+       c           *coder.Coder
 }
 
 // NewSideInputAdapter returns a side input adapter for the given StreamID and 
coder.
-// It expects a W<KV<K,V>> coder, because the protocol supports MultiSet 
access only.
+// It expects a W<V> or W<KV<K,V>> coder, because the protocol requires 
windowing information.
 func NewSideInputAdapter(sid StreamID, sideInputID string, c *coder.Coder, wm 
WindowMapper) SideInputAdapter {
-       if !coder.IsW(c) || !coder.IsKV(coder.SkipW(c)) {
-               panic(fmt.Sprintf("expected WKV coder for side input %v: %v", 
sid, c))
+       if !coder.IsW(c) {
+               panic(fmt.Sprintf("expected WV coder for side input %v: %v", 
sid, c))
        }
 
        wc := MakeWindowEncoder(c.Window)
-       kc := MakeElementEncoder(coder.SkipW(c).Components[0])
-       ec := MakeElementDecoder(coder.SkipW(c).Components[1])
-       return &sideInputAdapter{sid: sid, sideInputID: sideInputID, wc: wc, 
kc: kc, ec: ec, wm: wm}
+       var kc ElementEncoder
+       var ec ElementDecoder
+       if coder.IsKV(coder.SkipW(c)) {
+               kc = MakeElementEncoder(coder.SkipW(c).Components[0])
+               ec = MakeElementDecoder(coder.SkipW(c).Components[1])
+       } else {
+               ec = MakeElementDecoder(coder.SkipW(c))

Review comment:
       Could you help me understand why we need an encoder and decoder in the 
KV case, and just a decoder in this case (aka, please help Danny understand how 
we use Coders 😅)

##########
File path: sdks/go/pkg/beam/core/runtime/graphx/translate.go
##########
@@ -418,7 +379,7 @@ func (m *marshaller) addMultiEdge(edge NamedEdge) 
([]string, error) {
 
                                si[fmt.Sprintf("i%v", i)] = &pipepb.SideInput{
                                        AccessPattern: &pipepb.FunctionSpec{
-                                               Urn: URNMultimapSideInput,
+                                               Urn: URNIterableSideInput,
                                        },
                                        ViewFn: &pipepb.FunctionSpec{
                                                Urn: "foo",

Review comment:
       I know this is coming from the MultiMap version of this, but what does 
`Urn: "foo"` actually do here? Is this doing something different than just 
leaving the ViewFn empty would?




-- 
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: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to