MCPcopy Create free account
hub / github.com/apache/arrow-rs / take_native

Function take_native

arrow-select/src/take.rs:428–452  ·  view source on GitHub ↗
(
    values: &[T],
    indices: &PrimitiveArray<I>,
)

Source from the content-addressed store, hash-verified

426
427#[inline(never)]
428fn 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)]
455fn take_bits<I: ArrowPrimitiveType>(

Callers 3

take_primitiveFunction · 0.85
take_byte_viewFunction · 0.85
take_list_viewFunction · 0.85

Calls 11

defaultFunction · 0.85
filterMethod · 0.80
collectMethod · 0.80
as_usizeMethod · 0.80
nullsMethod · 0.45
null_countMethod · 0.45
iterMethod · 0.45
valuesMethod · 0.45
getMethod · 0.45
value_uncheckedMethod · 0.45
innerMethod · 0.45

Tested by

no test coverage detected