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


##########
arrow-select/src/take.rs:
##########
@@ -471,7 +471,8 @@ fn take_bits<I: ArrowPrimitiveType>(
             let output_slice = output_buffer.as_slice_mut();
             nulls.valid_indices().for_each(|idx| {
                 // SAFETY: idx is a valid index in indices.nulls() --> 
idx<indices.len()
-                if values.value(unsafe { 
indices.value_unchecked(idx).as_usize() }) {
+                // SAFETY: caller guarantees all valid indices are in-bounds
+                if unsafe { 
values.value_unchecked(indices.value_unchecked(idx).as_usize()) } {

Review Comment:
   I agree -- though it might be faster to validate the indices once at the 
[start of 
`take_impl`](https://github.com/apache/arrow-rs/blob/b737f992457557f17b7780e824f1ddfc656467fa/arrow-select/src/take.rs#L214-L213)
 and then use the unchecked accessors
   
   We could also potentially add a `take_unchecked` variant or something to 
skip the acces check
   



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