alamb commented on code in PR #8645:
URL: https://github.com/apache/arrow-rs/pull/8645#discussion_r2456553778


##########
arrow-select/src/concat.rs:
##########
@@ -206,6 +208,63 @@ fn concat_lists<OffsetSize: OffsetSizeTrait>(
     Ok(Arc::new(array))
 }
 
+fn concat_list_view<OffsetSize: OffsetSizeTrait>(
+    arrays: &[&dyn Array],
+    field: &FieldRef,
+) -> Result<ArrayRef, ArrowError> {
+    let mut output_len = 0;
+    let mut list_has_nulls = false;
+
+    let lists = arrays
+        .iter()
+        .map(|x| x.as_list_view::<OffsetSize>())
+        .inspect(|l| {
+            output_len += l.len();
+            list_has_nulls |= l.null_count() != 0;
+        })
+        .collect::<Vec<_>>();
+
+    let lists_nulls = list_has_nulls.then(|| {
+        let mut nulls = BooleanBufferBuilder::new(output_len);
+        for l in &lists {
+            match l.nulls() {
+                Some(n) => nulls.append_buffer(n.inner()),
+                None => nulls.append_n(l.len(), true),
+            }
+        }
+        NullBuffer::new(nulls.finish())
+    });
+
+    let values: Vec<&dyn Array> = lists.iter().map(|l| 
l.values().as_ref()).collect();

Review Comment:
   My long term idea is to use 
https://docs.rs/arrow/latest/arrow/compute/struct.BatchCoalescer.html
   
   However, it currently also has the notion of a target batch_size which is 
not important for this usecase



##########
arrow-data/src/equal/mod.rs:
##########
@@ -104,10 +105,9 @@ fn equal_values(
             byte_view_equal(lhs, rhs, lhs_start, rhs_start, len)
         }
         DataType::List(_) => list_equal::<i32>(lhs, rhs, lhs_start, rhs_start, 
len),
-        DataType::ListView(_) | DataType::LargeListView(_) => {
-            unimplemented!("ListView/LargeListView not yet implemented")
-        }
         DataType::LargeList(_) => list_equal::<i64>(lhs, rhs, lhs_start, 
rhs_start, len),
+        DataType::ListView(_) => list_view_equal::<i32>(lhs, rhs, lhs_start, 
rhs_start, len),
+        DataType::LargeListView(_) => list_view_equal::<i64>(lhs, rhs, 
lhs_start, rhs_start, len),

Review Comment:
   I think the tests for equality are in  
https://github.com/apache/arrow-rs/blob/39cda6207ed64a6b16cd0fb25b51c34c5496c30c/arrow/tests/array_equal.rs#L33-L32
   
   There is a comment at the end of the file that points the way
   ```rust
   // See arrow/tests/array_equal.rs for tests
   ```



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