Dandandan commented on code in PR #7614:
URL: https://github.com/apache/arrow-rs/pull/7614#discussion_r2132966060


##########
arrow-array/src/builder/generic_bytes_view_builder.rs:
##########
@@ -201,10 +201,40 @@ impl<T: ByteViewType + ?Sized> GenericByteViewBuilder<T> {
         let b = b.get_unchecked(start..end);
 
         let view = make_view(b, block, offset);
-        self.views_builder.append(view);
+        self.views_buffer.push(view);
         self.null_buffer_builder.append_non_null();
     }
 
+    /// Appends an array to the builder.
+    /// This will flush any in-progress block and append the data buffers
+    /// and add the (adapted) views.
+    pub fn append_array(&mut self, array: &GenericByteViewArray<T>) {
+        self.flush_in_progress();
+        self.completed.extend(array.data_buffers().iter().cloned());
+
+        if self.completed.is_empty() {

Review Comment:
   Shouldn't this be:
   
   ```
   @@ -210,9 +210,11 @@ impl<T: ByteViewType + ?Sized> 
GenericByteViewBuilder<T> {
        /// and add the (adapted) views.
        pub fn append_array(&mut self, array: &GenericByteViewArray<T>) {
            self.flush_in_progress();
   +        let keep_views = self.completed.is_empty() || 
array.data_buffers().is_empty();
   +
            self.completed.extend(array.data_buffers().iter().cloned());
   
   -        if self.completed.is_empty() {
   +        if keep_views {
                self.views_buffer.extend_from_slice(array.views());
            } else {
                let starting_buffer = self.completed.len() as u32;```



##########
arrow-array/src/builder/generic_bytes_view_builder.rs:
##########
@@ -201,10 +201,40 @@ impl<T: ByteViewType + ?Sized> GenericByteViewBuilder<T> {
         let b = b.get_unchecked(start..end);
 
         let view = make_view(b, block, offset);
-        self.views_builder.append(view);
+        self.views_buffer.push(view);
         self.null_buffer_builder.append_non_null();
     }
 
+    /// Appends an array to the builder.
+    /// This will flush any in-progress block and append the data buffers
+    /// and add the (adapted) views.
+    pub fn append_array(&mut self, array: &GenericByteViewArray<T>) {
+        self.flush_in_progress();
+        self.completed.extend(array.data_buffers().iter().cloned());
+
+        if self.completed.is_empty() {

Review Comment:
   Shouldn't this be:
   
   ```diff
   @@ -210,9 +210,11 @@ impl<T: ByteViewType + ?Sized> 
GenericByteViewBuilder<T> {
        /// and add the (adapted) views.
        pub fn append_array(&mut self, array: &GenericByteViewArray<T>) {
            self.flush_in_progress();
   +        let keep_views = self.completed.is_empty() || 
array.data_buffers().is_empty();
   +
            self.completed.extend(array.data_buffers().iter().cloned());
   
   -        if self.completed.is_empty() {
   +        if keep_views {
                self.views_buffer.extend_from_slice(array.views());
            } else {
                let starting_buffer = self.completed.len() as u32;```



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