Jefffrey commented on code in PR #11533:
URL: https://github.com/apache/arrow-rs/pull/11533#discussion_r4255454925


##########
arrow-schema/src/fields.rs:
##########
@@ -622,7 +628,9 @@ impl UnionFields {
 
 impl FromIterator<(i8, FieldRef)> for UnionFields {
     fn from_iter<T: IntoIterator<Item = (i8, FieldRef)>>(iter: T) -> Self {
-        Self(iter.into_iter().collect())
+        let iter = iter.into_iter();
+        let (type_ids, fields): (Vec<i8>, Vec<FieldRef>) = iter.unzip();
+        Self::try_new(type_ids, fields).expect("invalid arguments passed")

Review Comment:
   unfortunate that it introduces a panic, but this is better than letting in 
invalid data



-- 
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]

Reply via email to