Skip to content

Add value field accessors for list, fixedsizelist, listview, map & run arrays - #10661

Merged
Jefffrey merged 3 commits into
apache:mainfrom
emilk:emilk/field
Aug 14, 2026
Merged

Add value field accessors for list, fixedsizelist, listview, map & run arrays#10661
Jefffrey merged 3 commits into
apache:mainfrom
emilk:emilk/field

Conversation

@emilk

@emilk emilk commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

None

Rationale for this change

Given a ListArray I want to easily answer questions like "is the field nullable?" and "what is the underlying data type?". Now we can!

Same for other arrays (FixedSizeListArray etc)

What changes are included in this PR?

  • ListArray::value_field()
  • FixedSizeListArray::value_field()
  • GenericListViewArray::value_field() (ListView + LargeListView)
  • MapArray::entries_field(), MapArray::ordered()
  • RunArray::run_ends_field(), RunArray::values_field()

Are these changes tested?

No

Are there any user-facing changes?

Yes

@github-actions github-actions Bot added arrow Changes to the arrow crate arrow-array labels Aug 12, 2026
Mirrors ListArray::field for FixedSizeListArray, GenericListViewArray,
MapArray (entries_field, ordered) and RunArray (run_ends_field,
values_field). Also use FieldRef in ListArray::field's signature.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@Rich-T-kid Rich-T-kid left a comment

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.

@emilk makes sense to me, left a question for the REE methods

Comment on lines +210 to +215
pub fn run_ends_field(&self) -> &FieldRef {
match &self.data_type {
DataType::RunEndEncoded(f, _) => f,
_ => unreachable!(),
}
}

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.

nit: what are your thoughts on returning both fields in one method and allowing callers to determine what they want to use?

Suggested change
pub fn run_ends_field(&self) -> &FieldRef {
match &self.data_type {
DataType::RunEndEncoded(f, _) => f,
_ => unreachable!(),
}
}
pub fn run_end_fields(&self) -> (&FieldRef,&FieldRef) {
match &self.data_type {
DataType::RunEndEncoded(r, v) => (r,v),
_ => unreachable!(),
}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The benefit of having two functions is that we have names for each of the fields, instead of relying on docs explaining which order they are returned in.

rerun-sync Bot pushed a commit to rerun-io/rerun that referenced this pull request Aug 12, 2026
### Related
* apache/arrow-rs#10661

### What
Adds `re_arrow_util::list_field(list_array) -> &Arc<Field>`, replacing
the repeated

```rust
let field = match column.list_array.data_type() {
    arrow::datatypes::DataType::List(field) => field.clone(),
    _ => unreachable!("This is always s list array"),
};
```

pattern.

---------

Source-Ref: 30ea9420b5627637695ad3fe28780d0433c087c7
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Comment thread arrow-array/src/array/fixed_size_list_array.rs Outdated
@emilk emilk changed the title Add ListArray::field accessor Add ListArray::value_field accessor Aug 13, 2026
@Jefffrey Jefffrey added the enhancement Any new improvement worthy of a entry in the changelog label Aug 14, 2026
@Jefffrey
Jefffrey merged commit 3b75eb0 into apache:main Aug 14, 2026
34 of 36 checks passed
@Jefffrey

Copy link
Copy Markdown
Contributor

thanks @emilk & @Rich-T-kid

@Jefffrey Jefffrey changed the title Add ListArray::value_field accessor Add values field accessors for list, fixedsizelist, listview, map & run arrays Aug 14, 2026
@Jefffrey Jefffrey changed the title Add values field accessors for list, fixedsizelist, listview, map & run arrays Add value field accessors for list, fixedsizelist, listview, map & run arrays Aug 14, 2026
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 arrow-array enhancement Any new improvement worthy of a entry in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants