Skip to content

Commit

Permalink
coder marshaling tests
Browse files Browse the repository at this point in the history
  • Loading branch information
camphillips22 committed Nov 29, 2022
1 parent bf604de commit 2f24f56
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sdks/go/pkg/beam/core/runtime/graphx/coder.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,9 @@ func (b *CoderMarshaller) Add(c *coder.Coder) (string, error) {
case coder.String:
return b.internBuiltInCoder(urnStringCoder), nil

case coder.IW:
return b.internBuiltInCoder(urnIntervalWindow), nil

case coder.Row:
rt := c.T.Type()
s, err := schema.FromType(rt)
Expand Down
4 changes: 4 additions & 0 deletions sdks/go/pkg/beam/core/runtime/graphx/coder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ func TestMarshalUnmarshalCoders(t *testing.T) {
name: "baz",
c: baz,
},
{
name: "IW",
c: coder.NewIntervalWindowCoder(),
},
{
name: "W<bytes>",
c: coder.NewW(coder.NewBytes(), coder.NewGlobalWindow()),
Expand Down
6 changes: 6 additions & 0 deletions sdks/go/pkg/beam/core/runtime/graphx/dataflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ func EncodeCoderRef(c *coder.Coder) (*CoderRef, error) {
}
return &CoderRef{Type: windowedValueType, Components: []*CoderRef{elm, w}, IsWrapper: true}, nil

case coder.IW:
return &CoderRef{Type: intervalWindowType}, nil

case coder.Bytes:
return &CoderRef{Type: bytesType}, nil

Expand Down Expand Up @@ -305,6 +308,9 @@ func DecodeCoderRef(c *CoderRef) (*coder.Coder, error) {
return decodeDataflowCustomCoder(subC.Type)
}

case intervalWindowType:
return coder.NewIntervalWindowCoder(), nil

case windowedValueType:
if len(c.Components) != 2 {
return nil, errors.Errorf("bad windowed value: %+v", c)
Expand Down

0 comments on commit 2f24f56

Please sign in to comment.