Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions sdks/go/pkg/beam/runners/prism/internal/coders.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,17 @@ func pullDecoderNoAlloc(c *pipepb.Coder, coders map[string]*pipepb.Coder) func(i
ed(r)
wd(r)
}
case urns.CoderShardedKey:
ccids := c.GetComponentCoderIds()
if len(ccids) != 1 {
panic(fmt.Sprintf("ShardedKey coder must have only 1 component: %s", prototext.Format(c)))
}
kd := pullDecoderNoAlloc(coders[ccids[0]], coders)
return func(r io.Reader) {
l, _ := coder.DecodeVarInt(r)
ioutilx.ReadN(r, int(l))
kd(r)
}
case urns.CoderRow:
panic(fmt.Sprintf("Runner forgot to LP this Row Coder. %v", prototext.Format(c)))
default:
Expand Down
16 changes: 16 additions & 0 deletions sdks/go/pkg/beam/runners/prism/internal/coders_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,22 @@ func Test_pullDecoder(t *testing.T) {
},
},
[]byte{3, 0},
}, {
"sharded_key",
&pipepb.Coder{
Spec: &pipepb.FunctionSpec{
Urn: urns.CoderShardedKey,
},
ComponentCoderIds: []string{"key"},
},
map[string]*pipepb.Coder{
"key": {
Spec: &pipepb.FunctionSpec{
Urn: urns.CoderVarInt,
},
},
},
[]byte{3, 1, 2, 3, 255, 3},
},
}
for _, test := range tests {
Expand Down
Loading