Skip to content

fix(arrow): return an owned slice from Schema.FieldsByName - #1069

Open
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix/schema-fields-by-name-copy
Open

fix(arrow): return an owned slice from Schema.FieldsByName#1069
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix/schema-fields-by-name-copy

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Problem

For a unique name match, Schema.FieldsByName returned a one-element slice backed by the schema’s internal field storage. Mutating the returned element could therefore mutate the schema. The duplicate-name path and Schema.Fields already returned owned slices.

Change

Return a new one-element slice for the unique-match path, making ownership consistent across all successful FieldsByName results.

Coverage

The regression test mutates the returned field and verifies that the original schema remains unchanged.

Validation

go test ./arrow

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