Skip to content

GH-55715: [C++][Parquet] Release pre-buffered data in ParquetFileReader::Close() - #55716

Merged
kou merged 1 commit into
apache:mainfrom
kou:gh-55715-parquet-close-prebuffer
Nov 22, 2026
Merged

kou merged 1 commit into
apache:mainfrom
kou:gh-55715-parquet-close-prebuffer

Conversation

@kou

@kou kou commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Rationale for this change

ParquetFileReader::Close() doesn't release pre-buffered data. Pre-buffering is enabled by default. If the source is a memory mapped file, the pre-buffered data refers to the mapped memory. So the file is still mapped after we close the reader and the source. We can't remove a mapped file on Windows.

What changes are included in this PR?

Release pre-buffered data in SerializedFile::Close().

Are these changes tested?

Yes.

Are there any user-facing changes?

Yes.

Was AI used for this PR?

In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

…leReader::Close()

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 22, 2026 06:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the change to release Parquet pre-buffered data when the reader closes.

No open issues 🎉

What changed in this PR

Addresses #55715 by releasing Parquet pre-buffered data when the reader is closed, allowing memory-mapped files to be unmapped and removed on Windows after the source is also closed.

Changes:

  • Reset the cached source and clear pre-buffered column-chunk tracking in SerializedFile::Close().
  • Add a regression test using a zero-copy BufferReader to verify that closing the reader releases buffered references.
File Description
cpp/​src/​parquet/​file_reader.cc Release pre-buffered state when closing the reader.
cpp/​src/​parquet/​arrow/​arrow_reader_writer_test.cc Verify that closing releases references to the source buffer.

Review effort: Balanced

@wgtmac wgtmac left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix makes sense to me. Just FYI that there is a related fix: #49855

@kou

kou commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Thanks for the info! I'll merge this.

@kou
kou merged commit 8264a0d into apache:main Nov 22, 2026
58 of 82 checks passed
@kou
kou deleted the gh-55715-parquet-close-prebuffer branch November 22, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants