rluvaton commented on code in PR #6863:
URL: https://github.com/apache/arrow-rs/pull/6863#discussion_r1877812450
##########
arrow-array/src/builder/generic_list_builder.rs:
##########
@@ -168,6 +168,59 @@ where
}
}
+impl<OffsetSize, T: SpecificArrayBuilder> SpecificArrayBuilder for
GenericListBuilder<OffsetSize, T>
+where
+ OffsetSize: OffsetSizeTrait,
+{
+ type Output = GenericListArray<OffsetSize>;
+ type Item<'a> = T::Output;
+
+ /// Builds the array and reset this builder.
+ fn finish(&mut self) -> Arc<GenericListArray<OffsetSize>> {
+ Arc::new(self.finish())
+ }
+
+ /// Builds the array without resetting the builder.
+ fn finish_cloned(&self) -> Arc<GenericListArray<OffsetSize>> {
+ Arc::new(self.finish_cloned())
+ }
+
+ fn append_value<'a>(&'a mut self, value: Self::Item<'a>) {
+ // our item is their output
+ self.values_builder
+
.append_output(value.as_any().downcast_ref::<Self::Item<'a>>().unwrap());
+ self.append(true);
+ }
+
+ fn append_value_ref<'a>(&'a mut self, value: &'a Self::Item<'a>) {
+ self.values_builder
+
.append_output(value.as_any().downcast_ref::<Self::Item<'a>>().unwrap());
+ self.append(true);
+ }
+
+ fn append_null(&mut self) {
+ self.append(false);
+ }
+
+ fn append_output<'a>(&'a mut self, output: &'a Self::Output) {
+ // TODO - if iterator exists try it?
+ for i in 0..output.len() {
+ if output.is_null(i) {
+ self.append_null();
+ } else {
+ let current_value = output.value(i);
Review Comment:
thanks, I did not try to make it fast now, just to make it work as a proof
of concept
--
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]