-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Description
Describe the bug, including details regarding any error messages, version, and platform.
array.(*DenseUnionBuilder).Len and array.(*SparseUnionBuilder).Len always return 0. They should instead return the number of values appended.
This bug exists because these methods are promoted (via unionBuilder) from (*builder).Len, which reads builder.length, but DenseUnionBuilder and SparseUnionBuilder don't update that field.
It is a problem because some nested type builders require working child builder Len methods. For example, at present, a ListBuilder for a union child type always builds empty lists and a MapBuilder for a union key type always builds empty maps.
One way to fix this is to add a (*unionBuilder).Len implementation that calls unionBuilder.typesBuilder.Len.
// Len returns the current number of elements in the builder.
func (b *unionBuilder) Len() int { return b.typesBuilder.Len() }Component(s)
Go