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

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

                Author: ASF GitHub Bot
            Created on: 08/Feb/22 20:29
            Start Date: 08/Feb/22 20:29
    Worklog Time Spent: 10m 
      Work Description: jrmccluskey commented on a change in pull request 
#16775:
URL: https://github.com/apache/beam/pull/16775#discussion_r802032193



##########
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:
       In this particular context, we need coders when we're communicating with 
the runner over the Fn API. The key we are querying for the side input in a 
keyed context needs to be encoded when put into the proto, and then we need to 
decode the elements we get out from the runner so we can pass them back in the 
correct form. 




-- 
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: 723142)
    Time Spent: 2h 50m  (was: 2h 40m)

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