[
https://issues.apache.org/jira/browse/BEAM-13803?focusedWorklogId=723682&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-723682
]
ASF GitHub Bot logged work on BEAM-13803:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 09/Feb/22 14:22
Start Date: 09/Feb/22 14:22
Worklog Time Spent: 10m
Work Description: jrmccluskey commented on a change in pull request
#16775:
URL: https://github.com/apache/beam/pull/16775#discussion_r802712399
##########
File path: sdks/go/pkg/beam/core/runtime/exec/sideinput_test.go
##########
@@ -0,0 +1,201 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package exec
+
+import (
+ "context"
+ "fmt"
+ "io"
+ "reflect"
+ "testing"
+
+ "github.com/apache/beam/sdks/v2/go/pkg/beam/core/graph/coder"
+ "github.com/apache/beam/sdks/v2/go/pkg/beam/core/graph/window"
+ "github.com/apache/beam/sdks/v2/go/pkg/beam/core/typex"
+)
+
+func makeWindowedCoder() *coder.Coder {
+ vCoder := coder.NewDouble()
+ return coder.NewW(vCoder, coder.NewGlobalWindow())
+}
+
+func makeWindowedKVCoder() *coder.Coder {
+ kCoder := coder.NewString()
+ vCoder := coder.NewDouble()
+ kvCoder := coder.NewKV([]*coder.Coder{kCoder, vCoder})
+ return coder.NewW(kvCoder, coder.NewGlobalWindow())
+}
+
+func TestNewSideInputAdapter(t *testing.T) {
+ tests := []struct {
+ name string
+ sid StreamID
+ sideInputID string
+ c *coder.Coder
+ kc ElementEncoder
+ ec ElementDecoder
+ }{
+ {
+ name: "KV coder",
+ sid: StreamID{Port: Port{URL:
"localhost:8099"}, PtransformID: "n0"},
+ sideInputID: "i0",
+ c: makeWindowedKVCoder(),
+ kc: &stringEncoder{},
+ ec: &doubleDecoder{},
+ },
+ {
+ name: "V coder",
+ sid: StreamID{Port: Port{URL:
"localhost:8099"}, PtransformID: "n0"},
+ sideInputID: "i0",
+ c: makeWindowedCoder(),
+ kc: nil,
+ ec: &doubleDecoder{},
+ },
+ }
+ for _, test := range tests {
+ adapter := NewSideInputAdapter(test.sid, test.sideInputID,
test.c, nil)
+ adapterStruct, ok := adapter.(*sideInputAdapter)
+ if !ok {
+ t.Errorf("failed to convert interface to
sideInputAdapter struct in test %v", test)
+ }
+ if got, want := adapterStruct.sid, test.sid; got != want {
+ t.Errorf("got SID %v, want %v", got, want)
+ }
+ if got, want := adapterStruct.sideInputID, test.sideInputID;
got != want {
+ t.Errorf("got sideInputID %v, want %v", got, want)
+ }
+ if got, want := adapterStruct.c, test.c; got != want {
+ t.Errorf("got coder %v, want %v", got, want)
+ }
+ if got, want := reflect.TypeOf(adapterStruct.kc),
reflect.TypeOf(test.kc); got != want {
+ t.Errorf("got ElementEncoder type %v, want %v", got,
want)
+ }
+ if got, want := reflect.TypeOf(adapterStruct.ec),
reflect.TypeOf(test.ec); got != want {
+ t.Errorf("got ElementDecoder type %v, want %v", got,
want)
+ }
Review comment:
You're totally right, I dropped in the name field so it could be piped
through and forgot to put it into the error messages. t.Run() looks helpful
for that pattern, too
--
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: 723682)
Time Spent: 3h 20m (was: 3h 10m)
> 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: 3h 20m
> 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)