Rich-T-kid commented on code in PR #10441:
URL: https://github.com/apache/arrow-rs/pull/10441#discussion_r3865106378


##########
arrow-select/src/take.rs:
##########
@@ -766,31 +766,88 @@ fn take_fixed_size_list<IndexType: ArrowPrimitiveType>(
     indices: &PrimitiveArray<IndexType>,
     length: <UInt32Type as ArrowPrimitiveType>::Native,
 ) -> Result<FixedSizeListArray, ArrowError> {
-    let list_indices = take_value_indices_from_fixed_size_list(values, 
indices, length)?;
-    let taken = take_impl::<UInt32Type>(values.values().as_ref(), 
&list_indices)?;
+    let field = match values.data_type() {
+        DataType::FixedSizeList(field, _) => field.clone(),
+        d => unreachable!("take_fixed_size_list called with 
non-fixed-size-list data type {d}"),
+    };
 
-    // determine null count and null buffer, which are a function of `values` 
and `indices`
-    let num_bytes = bit_util::ceil(indices.len(), 8);
-    let mut null_buf = MutableBuffer::new(num_bytes).with_bitset(num_bytes, 
true);
-    let null_slice = null_buf.as_slice_mut();
+    let child = values.values();
+    let nulls = take_nulls(values.nulls(), indices);
 
-    for i in 0..indices.len() {
-        let index = indices
-            .value(i)
-            .to_usize()
-            .ok_or_else(|| ArrowError::ComputeError("Cast to usize 
failed".to_string()))?;
-        if !indices.is_valid(i) || values.is_null(index) {
-            bit_util::unset_bit(null_slice, i);
+    // Fast path: primitive child with no nulls — copy row-sized byte blocks 
directly,

Review Comment:
   this allows us to skip the O(N * list_size) intermediate UInt32 index array.



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