Copilot commented on code in PR #1743:
URL: https://github.com/apache/arrow-go/pull/1743#discussion_r4810740767
##########
parquet/file/file_reader.go:
##########
@@ -327,12 +336,18 @@ func (f *Reader) NumRowGroups() int {
func (f *Reader) RowGroup(i int) *RowGroupReader {
rg := f.metadata.RowGroups[i]
+ f.cacheMu.Lock()
+ cache := f.chunkCache
+ f.cacheMu.Unlock()
+
return &RowGroupReader{
fileMetadata: f.metadata,
rgMetadata: metadata.NewRowGroupMetaData(rg,
f.metadata.Schema, f.WriterVersion(), f.fileDecryptor),
+ rgIdx: i,
props: f.props,
r: f.r,
fileDecryptor: f.fileDecryptor,
+ chunkCache: cache,
Review Comment:
This snapshots the cache, so `rg := reader.RowGroup(0)` followed by
`reader.PreBuffer(...)` leaves `rg` using separate column reads despite the
registered plan. Existing row-group readers also retain the cleared old cache
when a plan is replaced. Resolve the current cache at column access or use a
stable shared cache handle, and test registration and replacement after
row-group reader creation.
##########
parquet/pqarrow/file_reader.go:
##########
@@ -616,17 +616,24 @@ func (fr *FileReader) getRecordReader(ctx
context.Context, colIndices, rowGroups
}
}
- // TODO(mtopol): add optimizations to pre-buffer data from the file
+ if fr.Props.PreBuffer {
+ if err := fr.rdr.PreBuffer(rowGroups, colIndices,
fr.Props.CacheOptions); err != nil {
Review Comment:
With `PreBuffer: true`, `Parallel: false`, and the default batch size,
`readBatch` reads the first field across every row group before starting the
next field. Other columns' slices remain cached, so compressed-data buffering
can grow with the entire projected file rather than one row group; oversized
batches have the same problem. Make consumption row-group-major even when
output batches span groups, or disable pre-buffering for that traversal, and
cover default and oversized batches.
--
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]