/// Take kernel for a single chunk and an iterator that can produce None values.
/// This is used in join operations.
///
/// # Safety
/// - no bounds checks
/// - iterator must be TrustedLen
Take kernel for a single chunk and an iterator that can produce None values.
This is used in join operations.
Take kernel for a single chunk and an iterator that can produce None values . This is used in join operations .
pub(crate) unsafe fn take_primitive_opt_iter_unchecked<
    T: PolarsPrimitiveType,
    I: IntoIterator<Item = Option<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(|opt_idx| {
        opt_idx.and_then(|idx| {
            if validity.get_bit_unchecked(idx) {
                Some(*array_values.get_unchecked(idx))
            } else {
                None
            }
        })
    });
    let arr = PrimitiveArray::from_trusted_len_iter_unchecked(iter).to(T::get_dtype().to_arrow());
    Arc::new(arr)
}
pub ( crate ) unsafe fn take_primitive_opt_iter_unchecked < T : PolarsPrimitiveType , I : IntoIterator < Item = Option < 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 ( | opt_idx | { opt_idx . and_then ( | idx | { if validity . get_bit_unchecked ( idx ) { Some ( * array_values . get_unchecked ( idx ) ) } else { None } } ) } ) ; let arr = PrimitiveArray :: from_trusted_len_iter_unchecked ( iter ) . to ( T :: get_dtype ( ) . to_arrow ( ) ) ; Arc :: new ( arr ) }
Take kernel for a single chunk and an iterator that can produce None values.
Take kernel for a single chunk and an iterator that can produce None values .
arr
&PrimitiveArray<T::Native>
indices
I
safety
no bounds checks
iterator must be TrustedLen
no bounds checks iterator must be TrustedLen