friendlymatthew commented on code in PR #8625:
URL: https://github.com/apache/arrow-rs/pull/8625#discussion_r2432793443


##########
parquet-variant-compute/src/variant_array.rs:
##########
@@ -439,6 +440,22 @@ impl From<VariantArray> for ArrayRef {
     }
 }
 
+impl<'m, 'v> FromIterator<Option<Variant<'m, 'v>>> for VariantArray {
+    fn from_iter<T: IntoIterator<Item = Option<Variant<'m, 'v>>>>(iter: T) -> 
Self {
+        let mut b = VariantArrayBuilder::new(0);
+        b.extend(iter);
+        b.build()
+    }
+}
+
+impl<'m, 'v> FromIterator<Variant<'m, 'v>> for VariantArray {
+    fn from_iter<T: IntoIterator<Item = Variant<'m, 'v>>>(iter: T) -> Self {
+        let mut b = VariantArrayBuilder::new(0);
+        b.extend(iter);
+        b.build()
+    }
+}
+

Review Comment:
   I wonder if there's a way to get the iterator size without consuming the 
iterator...
   
   But then again, I haven't ran a profile on the `VariantArray` code yet. I 
plan on looking at perf later on



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