Skip to content

fix(parquet/file): close file on OpenParquetFile errors - #1053

Open
fallintoplace wants to merge 2 commits into
apache:mainfrom
fallintoplace:fix/open-parquet-file-cleanup
Open

fix(parquet/file): close file on OpenParquetFile errors#1053
fallintoplace wants to merge 2 commits into
apache:mainfrom
fallintoplace:fix/open-parquet-file-cleanup

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

OpenParquetFile opens a file or mmap before constructing the reader. If initialization fails while parsing metadata, the function returned without closing that owned source.

What changes are included in this PR?

Require the internally opened source to implement ReaderAt, Seeker, and Closer, then close it when NewParquetReader fails. Preserve a simultaneous close failure with errors.Join.

Are these changes tested?

Yes. A close-tracking regression test verifies that malformed input closes the owned source, and the mmap signature cross-compiles on Windows.

go test ./parquet/file -run TestOpenParquetFileClosesSourceOnError

Are there any user-facing changes?

Invalid files still return an error, but their file descriptor or mmap is released promptly.

@fallintoplace
fallintoplace requested a review from zeroshade as a code owner July 29, 2026 16:53
@fallintoplace fallintoplace changed the title fix(parquet/file): close OpenParquetFile source when initialization fails fix(parquet/file): close file on OpenParquetFile errors Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant