You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "emilk (via GitHub)" <gi...@apache.org> on 2026/08/12 15:22:41 UTC
[PR] Add `ListArray::field` accessor [arrow-rs]
emilk opened a new pull request, #10661:
URL: https://github.com/apache/arrow-rs/pull/10661
# 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!
# What changes are included in this PR?
Add `ListArray::field()` accessor (and `GenericListArray` and `LargeListArray`)
# Are these changes tested?
No
# Are there any user-facing changes?
Yes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `ListArray::field` accessor [arrow-rs]
Posted by "emilk (via GitHub)" <gi...@apache.org>.
emilk commented on code in PR #10661:
URL: https://github.com/apache/arrow-rs/pull/10661#discussion_r3773155798
##########
arrow-array/src/array/fixed_size_list_array.rs:
##########
@@ -339,6 +339,14 @@ impl FixedSizeListArray {
(f, self.value_length, self.values, self.nulls)
}
+ /// The field that describes the values of this list.
+ pub fn field(&self) -> &FieldRef {
Review Comment:
I guess that also is more symmetric with `fn value_typeI)`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `ListArray::field` accessor [arrow-rs]
Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on code in PR #10661:
URL: https://github.com/apache/arrow-rs/pull/10661#discussion_r3769302862
##########
arrow-array/src/array/run_array.rs:
##########
@@ -206,6 +206,22 @@ impl<R: RunEndIndexType> RunArray<R> {
(self.data_type, self.run_ends, self.values)
}
+ /// The field that describes the run ends of this array.
+ pub fn run_ends_field(&self) -> &FieldRef {
+ match &self.data_type {
+ DataType::RunEndEncoded(f, _) => f,
+ _ => unreachable!(),
+ }
+ }
Review Comment:
nit: what are your thoughts on returning both fields in one method and allowing callers to determine what they want to use?
```suggestion
pub fn run_end_fields(&self) -> (&FieldRef,&FieldRef) {
match &self.data_type {
DataType::RunEndEncoded(r, v) => (r,v),
_ => unreachable!(),
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `ListArray::value_field` accessor [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey merged PR #10661:
URL: https://github.com/apache/arrow-rs/pull/10661
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `ListArray::value_field` accessor [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #10661:
URL: https://github.com/apache/arrow-rs/pull/10661#issuecomment-5291074633
thanks @emilk & @Rich-T-kid
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `ListArray::field` accessor [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on code in PR #10661:
URL: https://github.com/apache/arrow-rs/pull/10661#discussion_r3771641968
##########
arrow-array/src/array/fixed_size_list_array.rs:
##########
@@ -339,6 +339,14 @@ impl FixedSizeListArray {
(f, self.value_length, self.values, self.nulls)
}
+ /// The field that describes the values of this list.
+ pub fn field(&self) -> &FieldRef {
Review Comment:
```suggestion
pub fn values_field(&self) -> &FieldRef {
```
perhaps for clarity?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add `ListArray::field` accessor [arrow-rs]
Posted by "emilk (via GitHub)" <gi...@apache.org>.
emilk commented on code in PR #10661:
URL: https://github.com/apache/arrow-rs/pull/10661#discussion_r3773139588
##########
arrow-array/src/array/run_array.rs:
##########
@@ -206,6 +206,22 @@ impl<R: RunEndIndexType> RunArray<R> {
(self.data_type, self.run_ends, self.values)
}
+ /// The field that describes the run ends of this array.
+ pub fn run_ends_field(&self) -> &FieldRef {
+ match &self.data_type {
+ DataType::RunEndEncoded(f, _) => f,
+ _ => unreachable!(),
+ }
+ }
Review Comment:
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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org