Dandandan commented on code in PR #8861:
URL: https://github.com/apache/arrow-rs/pull/8861#discussion_r2535657259
##########
arrow-select/src/take.rs:
##########
@@ -419,16 +419,19 @@ fn take_native<T: ArrowNativeType, I: ArrowPrimitiveType>(
Some(n) => indices
.values()
.iter()
- .enumerate()
- .map(|(idx, index)| match values.get(index.as_usize()) {
- Some(v) => *v,
- // SAFETY: idx<indices.len()
- None => match unsafe { n.inner().value_unchecked(idx) } {
- false => T::default(),
- true => panic!("Out-of-bounds index {index:?}"),
- },
+ .zip((0..n.len()).map(|i| {
+ // SAFETY: i < n.len()
+ unsafe { n.inner().value_unchecked(i) }
+ }))
+ .map(|(index, valid)| {
+ if valid {
+ values[index.as_usize()]
Review Comment:
This also panics the same way? But it is more readable 👍
--
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]