| 426 | |
| 427 | #[inline(never)] |
| 428 | fn take_native<T: ArrowNativeType, I: ArrowPrimitiveType>( |
| 429 | values: &[T], |
| 430 | indices: &PrimitiveArray<I>, |
| 431 | ) -> ScalarBuffer<T> { |
| 432 | match indices.nulls().filter(|n| n.null_count() > 0) { |
| 433 | Some(n) => indices |
| 434 | .values() |
| 435 | .iter() |
| 436 | .enumerate() |
| 437 | .map(|(idx, index)| match values.get(index.as_usize()) { |
| 438 | Some(v) => *v, |
| 439 | // SAFETY: idx<indices.len() |
| 440 | None => match unsafe { n.inner().value_unchecked(idx) } { |
| 441 | false => T::default(), |
| 442 | true => panic!("Out-of-bounds index {index:?}"), |
| 443 | }, |
| 444 | }) |
| 445 | .collect(), |
| 446 | None => indices |
| 447 | .values() |
| 448 | .iter() |
| 449 | .map(|index| values[index.as_usize()]) |
| 450 | .collect(), |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | #[inline(never)] |
| 455 | fn take_bits<I: ArrowPrimitiveType>( |