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

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

                Author: ASF GitHub Bot
            Created on: 08/Feb/22 18:08
            Start Date: 08/Feb/22 18:08
    Worklog Time Spent: 10m 
      Work Description: 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: [email protected]

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


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

    Worklog Id:     (was: 723048)
    Time Spent: 2h 40m  (was: 2.5h)

> Add native iterable side input support to the Go SDK
> ----------------------------------------------------
>
>                 Key: BEAM-13803
>                 URL: https://issues.apache.org/jira/browse/BEAM-13803
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-go
>            Reporter: Jack McCluskey
>            Assignee: Jack McCluskey
>            Priority: P2
>          Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> The current Go SDK side input implementation handles all side inputs as map 
> side inputs, applying a fixed key to anything that is unkeyed and arranging 
> things into the correct form after the fact. This should be changed to avoid 
> adding an extra fixed key node and support iterable side inputs natively.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to