Skip to content

Conversation

@jhorstmann
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

Implement a convenient function to create list arrays of many more types from nested iterators.

What changes are included in this PR?

Are these changes tested?

yes, new tests added and the existing from_iter_primitive delegates to the new method for additional converage.

Are there any user-facing changes?

No breaking changes. The from_iter_primitive could potentially get deprecated.

@github-actions github-actions bot added the arrow Changes to the arrow crate label Jan 26, 2026
Copy link
Contributor

@Jefffrey Jefffrey left a comment

Choose a reason for hiding this comment

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

The from_iter_primitive could potentially get deprecated.

I'm of the opinion to keep it (don't deprecate), as using this new API means another generic is required and from_iter_primitive is already a bit gnarly with needing 3 generics 🤔

Self::from_nested_iter::<T::Native, PrimitiveBuilder<T>, P, I>(iter)
}

/// Creates a [`GenericListArray`] from an iterator of primitive values
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you be able to add some explanation on how this method differs from from_iter_primitive, when you would use this, etc.?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a sentence about the supported types, and changed the example to use more complicated type than from_iter_primitive.

I also reordered the generic parameters, in most cases only the builder type needs to be specified, all others can be inferred. Still, its one more generic than from_iter_primitive, so I would agree to keep that other method un-deprecated.

jhorstmann and others added 2 commits January 27, 2026 14:52
Co-authored-by: Jeffrey Vo <jeffrey.vo.australia@gmail.com>
Co-authored-by: Jeffrey Vo <jeffrey.vo.australia@gmail.com>
/// Some(vec![Some("bar"), None, Some("foo")]),
/// Some(vec![]),
/// ];
/// let list_array = ListArray::from_nested_iter::<StringDictionaryBuilder<Int32Type>, _, _, _>(data);
Copy link
Contributor

Choose a reason for hiding this comment

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

Amazing

/// let list_array = ListArray::from_nested_iter::<StringDictionaryBuilder<Int32Type>, _, _, _>(data);
/// println!("{:?}", list_array);
/// ```
pub fn from_nested_iter<B, T, P, I>(iter: I) -> Self
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe should we call it from_iter_primitive_nested to mirror from_iter_primitive ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can't have primitive in the name since this new API accepts strings too 🤔

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.

A more generic convenience method to create list arrays from nested iterators

3 participants