justinli500 commented on code in PR #49855:
URL: https://github.com/apache/arrow/pull/49855#discussion_r3593749848


##########
cpp/src/parquet/arrow/reader.cc:
##########
@@ -1275,10 +1239,31 @@ 
FileReaderImpl::GetRecordBatchGenerator(std::shared_ptr<FileReader> reader,
                        reader_properties_.cache_options());
     END_PARQUET_CATCH_EXCEPTIONS
   }
+  // GH-39808: evict each row group's bytes as the decoded prefix advances, so
+  // memory stays bounded. Only this read-once path evicts, so PreBuffer()'s
+  // contract is unchanged for other callers.
+  std::shared_ptr<ReadCacheEvictionState> eviction_state;
+  if (reader_properties_.pre_buffer() && !column_indices.empty() &&
+      !row_group_indices.empty()) {
+    const int64_t kNoMoreRanges = std::numeric_limits<int64_t>::max();
+    std::vector<int64_t> evict_before(row_group_indices.size() + 1, 
kNoMoreRanges);
+    for (int64_t i = static_cast<int64_t>(row_group_indices.size()) - 1; i >= 
0; --i) {

Review Comment:
   Just checked the descending order case - it seems safe, but eviction is 
conservative and may retain data until the lower-offset groups finish. The 
Dataset path targeted by this PR supplies ascending row groups, so I’ve kept 
the simpler watermark approach here. 
   
   I think progressive eviction for arbitrary row-group order would require 
broader range tracking, but I can extend the implementation if the maintainers 
would like that in this PR.



-- 
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]

Reply via email to