Skip to content

fix(arrow): avoid retains on invalid chunk construction - #1078

Merged
zeroshade merged 1 commit into
apache:mainfrom
fallintoplace:fix/chunked-construction-cleanup
Aug 5, 2026
Merged

fix(arrow): avoid retains on invalid chunk construction#1078
zeroshade merged 1 commit into
apache:mainfrom
fallintoplace:fix/chunked-construction-cleanup

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

NewChunked validated and retained inputs in the same loop. If an early chunk matched the requested datatype but a later chunk did not, the function panicked after retaining the earlier chunk. Callers that recovered and released their own references could not free its buffers.

What changes are included in this PR?

Validate every non-nil chunk datatype before retaining any input. Invalid construction now leaves all caller-owned reference counts unchanged. Successful construction, nil-chunk handling, and the existing panic value are unchanged.

Are these changes tested?

Yes. The existing invalid-chunk test now places a valid chunk before the mismatched chunk. Its checked allocator therefore verifies rollback in addition to the existing exact ErrInvalid assertion.

  • go test ./arrow/array
  • go test -race ./arrow/array -run '^TestChunkedInvalid$' -count=1

Are there any user-facing changes?

No API changes. Recovering from invalid chunk construction no longer leaves earlier inputs retained.

@fallintoplace
fallintoplace force-pushed the fix/chunked-construction-cleanup branch from 6524997 to 1f3d7bb Compare August 1, 2026 17:04
@fallintoplace
fallintoplace force-pushed the fix/chunked-construction-cleanup branch from 1f3d7bb to 865e363 Compare August 1, 2026 17:12
@zeroshade
zeroshade merged commit 0ad2d1d into apache:main Aug 5, 2026
40 of 41 checks passed
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