What happened?
In the documentation's Inferring Schemas section, it is stated, "Fields of interface types are ignored, unless a schema provider is registered for them."
However, when an interface is assigned to a field of a struct used for emitting, it results in an error instead of being ignored.
Is this an error in the documentation, or is there a bug?
This error has been occurring from Go SDK version v2.44.0 to the current latest version.
Here is a sample code that reproduces the issue:
func init() {
register.DoFn2x0[[]byte, func(*Foo)](&SampleFn{})
register.Emitter1[*Foo]() // Failure occurs when this line is added.
}
func main() {
beam.Init()
p, s := beam.NewPipelineWithRoot()
foo := beam.ParDo(s, &SampleFn{}, beam.Impulse(s))
fmt.Println(foo)
}
type Foo struct {
Bar Bar
}
type Bar interface {
Bar()
}
type BarImpl struct{}
func (p *BarImpl) Bar() {}
type SampleFn struct{}
func (fn *SampleFn) ProcessElement(_ []byte, emit func(h *Foo)) {
foo := &Foo{
Bar: &BarImpl{},
}
emit(foo)
}
When executing the above code, the following error occurs:
- : panic: error reconciling type Foo
caused by:
converting Foo to schema
cannot convert field Bar to schema
caused by:
unable to convert unsupported type Bar to schema
Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
Issue Components
What happened?
In the documentation's Inferring Schemas section, it is stated, "Fields of interface types are ignored, unless a schema provider is registered for them."
However, when an interface is assigned to a field of a struct used for emitting, it results in an error instead of being ignored.
Is this an error in the documentation, or is there a bug?
This error has been occurring from Go SDK version v2.44.0 to the current latest version.
Here is a sample code that reproduces the issue:
When executing the above code, the following error occurs:
Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
Issue Components