kou opened a new issue, #55715:
URL: https://github.com/apache/arrow/issues/55715

   ### Describe the enhancement requested
   
   `ParquetFileReader::Close()` doesn't release pre-buffered data. 
Pre-buffering is enabled by default.
   
   If we use `MemoryMappedFile`, the pre-buffered data refers to the mapped 
memory. So the file is still mapped after we close the reader and the source. 
The file is unmapped only when the reader is destroyed.
   
   This is a problem on Windows because we can't remove a mapped file. For 
example, this fails on Windows:
   
   1. Open a file with `MemoryMappedFile`
   2. Read data with the default `ArrowReaderProperties`
   3. Close the reader and the source
   4. Remove the file
   
   ```cpp
   ARROW_ASSIGN_OR_RAISE(
       auto source,
       arrow::io::MemoryMappedFile::Open(path, arrow::io::FileMode::READ));
   ARROW_ASSIGN_OR_RAISE(auto reader,
                         parquet::arrow::OpenFile(source, 
arrow::default_memory_pool()));
   std::shared_ptr<arrow::Table> table;
   ARROW_RETURN_NOT_OK(reader->ReadTable(&table));
   table.reset();
   reader->parquet_reader()->Close();
   ARROW_RETURN_NOT_OK(source->Close());
   // The file is still mapped here.
   ```
   
   
   ### Component(s)
   
   C++, Parquet


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