Skip to content

fix(arrow/array): validate struct builder field lengths#1021

Open
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix/struct-builder-field-lengths
Open

fix(arrow/array): validate struct builder field lengths#1021
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix/struct-builder-field-lengths

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

StructBuilder allows its field builders to diverge from the struct length. A shorter field currently causes a later slicing failure, while a longer field silently loses values when the array is finalized.

What changes are included in this PR?

  • Require every field builder length to match the struct builder length before finalization.
  • Report the mismatched field index and both lengths in the panic.
  • Replace the existing opaque missing-field failure with the explicit invariant check.

Are these changes tested?

Yes. The tests cover both missing and extra field values, including the previous silent-discard case. The full arrow/array package, assertion build, compute packages, IPC package, and CSV package also pass.

@fallintoplace
fallintoplace requested a review from zeroshade as a code owner July 25, 2026 20:20
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