tustvold commented on code in PR #6863:
URL: https://github.com/apache/arrow-rs/pull/6863#discussion_r1877805836
##########
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:
The performance of this will be very suboptimal, it would be better to
iterate the offsets directly
##########
arrow-array/src/array/boolean_array.rs:
##########
@@ -352,6 +352,18 @@ impl ArrayAccessor for &BooleanArray {
}
}
+impl ArrayAccessor for BooleanArray {
Review Comment:
This shouldn't be necessary as this is already implemented for &BooleanArray
##########
arrow-array/src/builder/boolean_builder.rs:
##########
@@ -219,6 +219,49 @@ impl ArrayBuilder for BooleanBuilder {
}
}
+
+impl SpecificArrayBuilder for BooleanBuilder {
Review Comment:
The functionality of this trait seems to overlap with the existing extend
functionality, I'm not sure what it is adding
--
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]