yyy1000 commented on issue #23101:
URL: https://github.com/apache/beam/issues/23101#issuecomment-1365779041
I reproduced the error message successfully.
But when I use the struct type to wrap the Map type, there's still a
problem. It seems the map struct is still unencodable.
Could you please help to see what's my problem? :)
My code is like this:
```
type MyNewStruct struct {
Map map[int]int
}
func Test(t *testing.T) {
f, _ := coderx.NewVarIntZ(reflectx.Int)
foo := &coder.Coder{Kind: coder.Custom, T: typex.New(reflectx.Int),
Custom: f}
//coder.NewCustomCoder
bar := custom("bar", reflect.TypeOf((*MyNewStruct)(nil)).Elem())
tests := []struct {
name string
c *coder.Coder
equivalent *coder.Coder
}{
{
name: "KV<foo,bar>",
c: coder.NewKV([]*coder.Coder{foo,bar}),
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
_, _, err :=
graphx.MarshalCoders([]*coder.Coder{test.c})
if err != nil {
t.Fatalf("Marshal(%v) failed: %v", test.c, err)
}
})
}
}
```
The error message is:
> Full error:
failed to marshal the coder
KV<int[varintz],graphx_test.MyNewStruct[bar]>.
caused by:
failed to marshal KV coder
KV<int[varintz],graphx_test.MyNewStruct[bar]>
caused by:
failed to marshal the coder graphx_test.MyNewStruct[bar].
caused by:
encoding custom coder graphx_test.MyNewStruct[bar] for type
graphx_test.MyNewStruct
encoding struct graphx_test.MyNewStruct
bad field type
caused by:
unencodable type map[int]int
--
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]