pub(crate) unsafe fn take_primitive_iter_unchecked<
    T: PolarsPrimitiveType,
    I: IntoIterator<Item = usize>,
>(
    arr: &PrimitiveArray<T::Native>,
    indices: I,
) -> Arc<PrimitiveArray<T::Native>> {
    let array_values = arr.values().as_slice();
    let validity = arr.validity().as_ref().expect("should have nulls");

    let iter = indices.into_iter().map(|idx| {
        if validity.get_bit_unchecked(idx) {
            Some(*array_values.get_unchecked(idx))
        } else {
            None
        }
    });

    let arr = PrimitiveArray::from_trusted_len_iter_unchecked(iter);
    Arc::new(arr)
}
/// Take kernel for a single chunk with null values and an iterator as index.
///
/// # Safety
/// - no bounds checks
/// - iterator must be TrustedLen
Take kernel for a single chunk with null values and an iterator as index.
Take kernel for a single chunk with null values and an iterator as index .
pub(crate) unsafe fn take_primitive_iter_unchecked<
    T: PolarsPrimitiveType,
    I: IntoIterator<Item = usize>,
>(
    arr: &PrimitiveArray<T::Native>,
    indices: I,
) -> Arc<PrimitiveArray<T::Native>> {
    let array_values = arr.values().as_slice();
    let validity = arr.validity().as_ref().expect("should have nulls");
    let iter = indices.into_iter().map(|idx| {
        if validity.get_bit_unchecked(idx) {
            Some(*array_values.get_unchecked(idx))
        } else {
            None
        }
    });
    let arr = PrimitiveArray::from_trusted_len_iter_unchecked(iter);
    Arc::new(arr)
}
pub ( crate ) unsafe fn take_primitive_iter_unchecked < T : PolarsPrimitiveType , I : IntoIterator < Item = usize > , > ( arr : & PrimitiveArray < T :: Native > , indices : I , ) -> Arc < PrimitiveArray < T :: Native > > { let array_values = arr . values ( ) . as_slice ( ) ; let validity = arr . validity ( ) . as_ref ( ) . expect ( " " ) ; let iter = indices . into_iter ( ) . map ( | idx | { if validity . get_bit_unchecked ( idx ) { Some ( * array_values . get_unchecked ( idx ) ) } else { None } } ) ; let arr = PrimitiveArray :: from_trusted_len_iter_unchecked ( iter ) ; Arc :: new ( arr ) }
Take kernel for a single chunk with null values and an iterator as index.
Take kernel for a single chunk with null values and an iterator as index .
arr
&PrimitiveArray<T::Native>
indices
I
arr
&PrimitiveArray<T::Native>
indices
I
safety
no bounds checks
iterator must be TrustedLen
no bounds checks iterator must be TrustedLen