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 28, 2022
1 parent 203ca05 commit f28028a
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 @@ -525,6 +525,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 @@ -84,6 +84,10 @@ func TestMarshalUnmarshalCoders(t *testing.T) {
"baz",
baz,
},
{
name: "IW",
c: coder.NewIntervalWindowCoder(),
},
{
"W<bytes>",
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 @@ -164,6 +164,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 @@ -301,6 +304,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 f28028a

Please sign in to comment.