Ah, I see - I didn't realize the problem was happening post-registration. This error originates from https://github.com/apache/beam/blob/8b2676782a62f8bdf912395267056c9f37251338/sdks/go/pkg/beam/core/runtime/graphx/serialize.go#L502 and basically means that we are not able to infer a default coder for your type (in this case *interface{}). More information about coders can be found at https://beam.apache.org/documentation/programming-guide/#data-encoding-and-type-safety
Normally, the correct way to resolve this would be to register a custom coder <https://beam.apache.org/documentation/programming-guide/#setting-default-coder> for *interface{} - https://beam.apache.org/documentation/programming-guide/#setting-default-coder - could you try doing that? On Fri, Sep 16, 2022 at 9:28 AM Rener Pereira De Castro < [email protected]> wrote: > Hi Danny, > > > > Thank you for your answer. > > > > This code below doesn’t work for me: > > > > *register.Iter1[interface{}]() * > > *register.DoFn3x1[context.Context, int, func(*interface{}) bool, > error](&writeParquetFn{}) * > > > > I'm having this error when trying to run on Dataflow: > > ``` > > bad input type > > caused by: > > encoding full type interface {} > > bad type > > caused by: > > unencodable type interface {} > > ``` > > > > Regards, > > ------------------------------ > *From:* Danny McCormick <[email protected]> > *Sent:* Friday, September 16, 2022 10:07 AM > *To:* [email protected] <[email protected]>; Rener Pereira De > Castro <[email protected]> > *Subject:* Re: [Question] [Go SDK] Generic Register DoFn having > iter(*interface{}) > > Hey Rener, you should be able to register that function with > `register.DoFn3x1[context.Context, int, func(*interface{}) bool, error]`. > You would use DoFn3x1 because you have 3 inputs and 1 output in your > ProcessElement, and then the constraints are just the input types to your > ProcessElement function. > > Thanks, > Danny > > On Fri, Sep 16, 2022 at 7:44 AM Rener Pereira De Castro via user < > [email protected]> wrote: > > Hi guys, > > > I can't find a way to generic register a DoFn with ProcessElement like > *parquetWriteFn - ProcessElement(ctx context.Context, _ int, iter > func(*interface{}) bool) > (https://github.com/apache/beam/blob/30a48f05cf2ee0eea0a304fea01eb40f323f9f3c/sdks/go/pkg/beam/io/parquetio/parquetio.go#L150 > <https://protect2.fireeye.com/v1/url?k=31323334-501cfaeb-31350c47-454455535732-783c0a34be56f4a0&q=1&e=163b1df8-451a-4632-b4f9-df898c6a9902&u=https%3A%2F%2Fgithub.com%2Fapache%2Fbeam%2Fblob%2F30a48f05cf2ee0eea0a304fea01eb40f323f9f3c%2Fsdks%2Fgo%2Fpkg%2Fbeam%2Fio%2Fparquetio%2Fparquetio.go%23L150>)* > > I'm having this error: > ``` > bad input type > caused by: > encoding full type interface {} > bad type > caused by: > unencodable type interface {} > ``` > > Any help on that will be greatly appreciated > > > Regards, > > *Rener Castro* > *Data & Analytics* > email: *[email protected]* <[email protected]> > > [image: signature_1033755691] > > > Classificação: Interna > > Classificação: Interna > > > Classificação: Interna > > Classificação: Interna >
