/// Take kernel for single chunk and an iterator as index.
Take kernel for single chunk and an iterator as index.
Take kernel for single chunk and an iterator as index .
pub(crate) unsafe fn take_agg_primitive_iter_unchecked<
    T: PolarsNumericType,
    I: IntoIterator<Item = usize>,
    F: Fn(T::Native, T::Native) -> T::Native,
>(
    arr: &PrimitiveArray<T::Native>,
    indices: I,
    f: F,
    init: T::Native,
) -> Option<T::Native> {
    if arr.null_count() == arr.len() {
        return None;
    }
    let array_values = arr.values().as_slice();
    let validity = arr
        .validity()
        .as_ref()
        .expect("null buffer should be there");
    let out = indices.into_iter().fold(init, |acc, idx| {
        if validity.get_bit_unchecked(idx) {
            f(acc, *array_values.get_unchecked(idx))
        } else {
            acc
        }
    });
    if out == init {
        None
    } else {
        Some(out)
    }
}
pub ( crate ) unsafe fn take_agg_primitive_iter_unchecked < T : PolarsNumericType , I : IntoIterator < Item = usize > , F : Fn ( T :: Native , T :: Native ) -> T :: Native , > ( arr : & PrimitiveArray < T :: Native > , indices : I , f : F , init : T :: Native , ) -> Option < T :: Native > { if arr . null_count ( ) == arr . len ( ) { return None ; } let array_values = arr . values ( ) . as_slice ( ) ; let validity = arr . validity ( ) . as_ref ( ) . expect ( " " ) ; let out = indices . into_iter ( ) . fold ( init , | acc , idx | { if validity . get_bit_unchecked ( idx ) { f ( acc , * array_values . get_unchecked ( idx ) ) } else { acc } } ) ; if out == init { None } else { Some ( out ) } }
Take kernel for single chunk and an iterator as index.
Take kernel for single chunk and an iterator as index .
arr
&PrimitiveArray<T::Native>
indices
I
f
F
init
T::Native