Skip to content

fix(parquet/pqarrow): release partially constructed field readers - #1061

Open
fallintoplace wants to merge 2 commits into
apache:mainfrom
fallintoplace:fix/pqarrow-field-reader-cleanup
Open

fix(parquet/pqarrow): release partially constructed field readers#1061
fallintoplace wants to merge 2 commits into
apache:mainfrom
fallintoplace:fix/pqarrow-field-reader-cleanup

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

GetFieldReaders constructs readers concurrently. If one fails after another succeeds, the successful reader remains in a private slice and is never returned, so the caller cannot release it.

What changes are included in this PR?

When construction fails, release every non-nil reader that completed before returning the original error.

Are these changes tested?

Yes. The regression test injects a read failure at the second column chunk after the first reader has been constructed. Without the cleanup, the checked allocator reports the first page reader's retained buffer; with the fix, allocator usage returns to zero.

go test ./parquet/pqarrow -run TestGetFieldReadersReleasesPartialReadersOnError

Are there any user-facing changes?

No API changes. Failed multi-column reader construction now cleans up partial results.

@fallintoplace
fallintoplace requested a review from zeroshade as a code owner July 29, 2026 16:56
})
}
if err = g.Wait(); err != nil {
for _, rdr := range out {

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.

Can we add a unit test to repro the bug?

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.

2 participants