Skip to content

Conversation

@friendlymatthew
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

This PR introduces 2 ways to access elements of UnionFields by index. You can now use direct indexing (fields[idx]) or the safe accessor UnionFields::get(index: usize) to avoid potential panics

Note, since we validate UnionFields contains only 128 elements upon construction, we can forgo this check upon read

@github-actions github-actions bot added the arrow Changes to the arrow crate label Dec 5, 2025
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me -- thank you @friendlymatthew

@alamb alamb merged commit 42b690c into apache:main Dec 11, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

impl Index for UnionFields

2 participants