When I build an arrow record that has a struct, and that struct has a field with the type arrow.FixedWidthTypes.Boolean
, it later panics when trying to access the boolean value with the following error:
runtime error: invalid memory address or nil pointer dereference
The following code successfully reads the string value, but not the boolean value:
mem := memory.NewGoAllocator()
fields := []arrow.Field{
{Name: "my struct", Type: arrow.StructOf([]arrow.Field{
{Name: "my string", Type: arrow.BinaryTypes.String},
{Name: "my bool", Type: arrow.FixedWidthTypes.Boolean},
}...)},
}
schema := arrow.NewSchema(fields, nil)
bld := array.NewRecordBuilder(mem, schema)
defer bld.Release()
sb := bld.Field(0).(*array.StructBuilder)
f1b := sb.FieldBuilder(0).(*array.StringBuilder)
f2b := sb.FieldBuilder(1).(*array.BooleanBuilder)
sb.AppendValues([]bool{true})
f1b.AppendValues([]string{"someone", "was", "here"}, nil)
f2b.AppendValues([]bool{false, true, true}, nil)
r := bld.NewRecord()
struc := r.Column(0).(*array.Struct)
Expect(struc.Field(0).(*array.String).Value(0)).ToNot(Panic())
Expect(struc.Field(1).(*array.Boolean).Value(0)).To(Panic())