Hello,
I'm just getting started with the go library and I may have
misunderstandings. I'm wondering if it is possible to rewrite the following
test in a way that will not allocate new buffers on successive calls to
NewRecord.
Thanks for any advice - code below.
Wyatt
func TestBuilder(t *testing.T) {
pool := memory.NewGoAllocator()
schema := arrow.NewSchema([]arrow.Field{
{Name: "data", Type: arrow.PrimitiveTypes.Float64},
}, nil)
builder := array.NewRecordBuilder(pool, schema)
defer builder.Release()
fb := builder.Field(0).(*array.Float64Builder)
// Max size the field attains
fb.Reserve(2)
// Write 100 record batches
for i := 0; i < 100; i++ {
// Two float observations per record
for j := 0; j < 2; j++ {
fb.Append(float64(j))
}
// Why does this call mem.Allocate() on every call?
// Why is builder.cap zeroed on calls to reset instead of
retained?
record := builder.NewRecord()
// do something with the record...
record.Release()
}
}