[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Go SDK: bad parameter type for reflect.methodValueCall: func(Record)

Hi Eduardo,

 You're not doing anything wrong. Maps are currently not classified as a valid data type by the type checker, but perhaps they should be.


Please feel free to open a bug. As a less-than-convenient workaround, you can use a slice.


On Mon, Jun 18, 2018 at 2:10 PM eduardo.morales@xxxxxxxxx <eduardo.morales@xxxxxxxxx> wrote:
I have the following code:

type Record struct {
       Timestamp time.Time
       Payload   string

type processFn struct {
        // etc...

func (f *processFn) ProcessElement(ctx context.Context, data []byte, emit func(Record)) {
         // etc..
         // etc...

Which is eventually invoked as:
beam.ParDo(scope, &processFn{}, pcoll)

This seems to work fine using the direct runner until I add a map to the Record struct as follows:

type Record struct {
        Timestamp    time.Time
        Payload      string
        Labels       map[string]string

Then I get the error mentioned in the subject line.

My questions are:
- Are maps illegal? What is a legal structure? or
- Is the feature yet to be implemented? or
- Am I doing something wrong? Am I failing to setup my pipeline correctly?

Thanks for your help.