zeroshade commented on code in PR #838:
URL: https://github.com/apache/arrow-go/pull/838#discussion_r3374847768
##########
parquet/pqarrow/encode_arrow_test.go:
##########
@@ -2027,7 +2027,9 @@ func (ps *ParquetIOTestSuite) TestLargeListRoundTrip() {
cnk := arrow.NewChunked(field.Type, []arrow.Array{arr})
defer arr.Release()
- tbl := array.NewTable(arrow.NewSchema([]arrow.Field{field}, nil),
[]arrow.Column{*arrow.NewColumn(field, cnk)}, -1)
+ col := arrow.NewColumn(field, cnk)
+ defer col.Release()
+ tbl := array.NewTable(arrow.NewSchema([]arrow.Field{field}, nil),
[]arrow.Column{*col}, -1)
defer cnk.Release()
defer tbl.Release()
Review Comment:
This can be simplified with a helper that we already have:
https://pkg.go.dev/github.com/apache/arrow-go/[email protected]/arrow/array#NewTableFromSlice
```go
tbl := array.NewTableFromSlice(arrow.NewSchema([]arrow.Field{field}, nil),
[][]arrow.Array{{arr}})
defer tbl.Release()
```
That helper was added specifically to avoid having to separately do the
intermediate steps of Array -> Chunk -> Column in consumer code, simplifying
the work and avoiding the flood of defers here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]