// take implementation when only indices contain nulls
take implementation when only indices contain nulls
take implementation when only indices contain nulls
fn take_indices_validity<T: NativeType, I: Index>(
    values: &[T],
    indices: &PrimitiveArray<I>,
) -> (Buffer<T>, Option<Bitmap>) {
    let validity = indices.validity().unwrap();
    let values = indices.values().iter().enumerate().map(|(i, index)| {
        let index = index.to_usize();
        match values.get(index) {
            Some(value) => *value,
            None => {
                if !validity.get_bit(i) {
                    T::default()
                } else {
                    panic!("Out-of-bounds index {}", index)
                }
            }
        }
    });
    let buffer = MutableBuffer::from_trusted_len_iter(values);
    (buffer.into(), indices.validity().cloned())
}
fn take_indices_validity < T : NativeType , I : Index > ( values : & [ T ] , indices : & PrimitiveArray < I > , ) -> ( Buffer < T > , Option < Bitmap > ) { let validity = indices . validity ( ) . unwrap ( ) ; let values = indices . values ( ) . iter ( ) . enumerate ( ) . map ( | ( i , index ) | { let index = index . to_usize ( ) ; match values . get ( index ) { Some ( value ) => * value , None => { if ! validity . get_bit ( i ) { T :: default ( ) } else { panic ! ( " " index ) } } } } ) ; let buffer = MutableBuffer :: from_trusted_len_iter ( values ) ; ( buffer . into ( ) , indices . validity ( ) . cloned ( ) ) }
take implementation when only indices contain nulls
take implementation when only indices contain nulls
values
&[T]
indices
&PrimitiveArray<I>