candiduslynx commented on code in PR #35971:
URL: https://github.com/apache/arrow/pull/35971#discussion_r1221889762
##########
go/parquet/pqarrow/column_readers.go:
##########
@@ -443,14 +454,16 @@ func chunksToSingle(chunked *arrow.Chunked)
(arrow.ArrayData, error) {
case 0:
return array.NewData(chunked.DataType(), 0,
[]*memory.Buffer{nil, nil}, nil, 0, 0), nil
case 1:
- return chunked.Chunk(0).Data(), nil
+ data := chunked.Chunk(0).Data()
+ data.Retain() // we pass control to the caller
Review Comment:
we want the caller to have the full control of the data (so, releasing the
array after the `chunksToSingle` should have no effect on the returned data.
For 0 len it was already true (we constructed a new data), so this retain
comes in naturally
##########
go/parquet/pqarrow/column_readers.go:
##########
@@ -443,14 +454,16 @@ func chunksToSingle(chunked *arrow.Chunked)
(arrow.ArrayData, error) {
case 0:
return array.NewData(chunked.DataType(), 0,
[]*memory.Buffer{nil, nil}, nil, 0, 0), nil
case 1:
- return chunked.Chunk(0).Data(), nil
+ data := chunked.Chunk(0).Data()
+ data.Retain() // we pass control to the caller
+ return data, nil
default: // if an item reader yields a chunked array, this is not yet
implemented
return nil, arrow.ErrNotImplemented
}
}
// create a chunked arrow array from the raw record data
-func transferColumnData(rdr file.RecordReader, valueType arrow.DataType, descr
*schema.Column, mem memory.Allocator) (*arrow.Chunked, error) {
+func transferColumnData(rdr file.RecordReader, valueType arrow.DataType, descr
*schema.Column) (*arrow.Chunked, error) {
Review Comment:
mem param was unused
--
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]