Jefffrey commented on code in PR #9268:
URL: https://github.com/apache/arrow-rs/pull/9268#discussion_r2734736277
##########
arrow-array/src/array/list_array.rs:
##########
@@ -418,18 +418,43 @@ impl<OffsetSize: OffsetSizeTrait>
GenericListArray<OffsetSize> {
T: ArrowPrimitiveType,
P: IntoIterator<Item = Option<<T as ArrowPrimitiveType>::Native>>,
I: IntoIterator<Item = Option<P>>,
+ {
+ Self::from_nested_iter::<PrimitiveBuilder<T>, T::Native, P, I>(iter)
+ }
+
+ /// Creates a [`GenericListArray`] from a nested iterator of values.
+ /// This method works for any values type that has a corresponding builder
that implements the
+ /// `Extend` trait. That includes all numeric types, booleans, binary and
string types and also
+ /// dictionary encoded binary and strings.
+ ///
+ /// # Example
+ /// ```
+ /// # use arrow_array::ListArray;
+ /// # use arrow_array::types::Int32Type;
+ /// # use arrow_array::builder::StringDictionaryBuilder;
+ /// let data = vec![
+ /// Some(vec![Some("foo"), Some("bar"), Some("baz")]),
+ /// None,
+ /// Some(vec![Some("bar"), None, Some("foo")]),
+ /// Some(vec![]),
+ /// ];
+ /// 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
Review Comment:
I think we can't have `primitive` in the name since this new API accepts
strings too 🤔
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]