justinli500 commented on code in PR #49855:
URL: https://github.com/apache/arrow/pull/49855#discussion_r3726304151
##########
cpp/src/parquet/arrow/reader_internal.h:
##########
@@ -133,5 +135,50 @@ Status
TransferColumnData(::parquet::internal::RecordReader* reader,
const ColumnDescriptor* descr, const ReaderContext*
ctx,
std::shared_ptr<::arrow::ChunkedArray>* out);
+// ----------------------------------------------------------------------
+// Pre-buffer eviction
+
+// GH-39808: as row groups finish decoding (possibly out of order under
+// readahead), advance a watermark over the leading run of completed ones and
+// evict cache entries ending before the lowest byte any remaining one needs.
+class ReadCacheEvictionState {
+ public:
+ // evict_before_offsets[i] = lowest byte offset row groups i..n-1 (in
+ // generator order) still need; evict_before_offsets[n] == INT64_MAX.
+ explicit ReadCacheEvictionState(std::vector<int64_t> evict_before_offsets)
+ : evict_before_offsets_(std::move(evict_before_offsets)),
+ completed_(evict_before_offsets_.size() - 1, false) {}
+
+ void RowGroupDecoded(ParquetFileReader* reader, size_t row_group_index) {
+ if (auto evict_before = MarkDecodedAndGetEvictOffset(row_group_index)) {
+ reader->EvictPreBufferedDataBefore(*evict_before);
Review Comment:
Ah right sorry about that - I changed it so this is only enabled by the
Dataset reader, and normal file readers keep the existing behavior. I added a
test for that too.
--
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]