pub fn aligned_vec_to_primitive_array<T: ArrowPrimitiveType>(
    values: AlignedVec<T::Native>,
    null_bit_buffer: Option<Buffer>,
    null_count: Option<usize>,
) -> PrimitiveArray<T> {
    let values = unsafe { values.into_inner() };
    let vec_len = values.len();

    let me = mem::ManuallyDrop::new(values);
    let ptr = me.as_ptr() as *const u8;
    let len = me.len() * std::mem::size_of::<T::Native>();
    let capacity = me.capacity() * std::mem::size_of::<T::Native>();
    debug_assert_eq!((ptr as usize) % 64, 0);

    let buffer = unsafe { Buffer::from_raw_parts(ptr, len, capacity) };

    let builder = ArrayData::builder(T::get_data_type())
        .len(vec_len)
        .add_buffer(buffer);

    let builder = set_null_bits(builder, null_bit_buffer, null_count, vec_len);
    let data = builder.build();

    PrimitiveArray::<T>::from(data)
}
/// Take an owned Vec that is 64 byte aligned and create a zero copy PrimitiveArray
/// Can also take a null bit buffer into account.
Take an owned Vec that is 64 byte aligned and create a zero copy PrimitiveArray
Can also take a null bit buffer into account.
Take an owned Vec that is 64 byte aligned and create a zero copy PrimitiveArray Can also take a null bit buffer into account .
pub fn aligned_vec_to_primitive_array<T: ArrowPrimitiveType>(
    values: AlignedVec<T::Native>,
    null_bit_buffer: Option<Buffer>,
    null_count: Option<usize>,
) -> PrimitiveArray<T> {
    let values = unsafe { values.into_inner() };
    let vec_len = values.len();
    let me = mem::ManuallyDrop::new(values);
    let ptr = me.as_ptr() as *const u8;
    let len = me.len() * std::mem::size_of::<T::Native>();
    let capacity = me.capacity() * std::mem::size_of::<T::Native>();
    debug_assert_eq!((ptr as usize) % 64, 0);
    let buffer = unsafe { Buffer::from_raw_parts(ptr, len, capacity) };
    let builder = ArrayData::builder(T::get_data_type())
        .len(vec_len)
        .add_buffer(buffer);
    let builder = set_null_bits(builder, null_bit_buffer, null_count, vec_len);
    let data = builder.build();
    PrimitiveArray::<T>::from(data)
}
pub fn aligned_vec_to_primitive_array < T : ArrowPrimitiveType > ( values : AlignedVec < T :: Native > , null_bit_buffer : Option < Buffer > , null_count : Option < usize > , ) -> PrimitiveArray < T > { let values = unsafe { values . into_inner ( ) } ; let vec_len = values . len ( ) ; let me = mem :: ManuallyDrop :: new ( values ) ; let ptr = me . as_ptr ( ) as * const u8 ; let len = me . len ( ) * std :: mem :: size_of :: < T :: Native > ( ) ; let capacity = me . capacity ( ) * std :: mem :: size_of :: < T :: Native > ( ) ; debug_assert_eq ! ( ( ptr as usize ) 64 0 ) ; let buffer = unsafe { Buffer :: from_raw_parts ( ptr , len , capacity ) } ; let builder = ArrayData :: builder ( T :: get_data_type ( ) ) . len ( vec_len ) . add_buffer ( buffer ) ; let builder = set_null_bits ( builder , null_bit_buffer , null_count , vec_len ) ; let data = builder . build ( ) ; PrimitiveArray :: < T > :: from ( data ) }
Take an owned Vec that is 64 byte aligned and create a zero copy PrimitiveArray
Can also take a null bit buffer into account.
Take an owned Vec that is 64 byte aligned and create a zero copy PrimitiveArray Can also take a null bit buffer into account .
values
AlignedVec<T::Native>
null_bit_buffer
Option<Buffer>
null_count
Option<usize>
values
AlignedVec<T::Native>
null_bit_buffer
Option<Buffer>
null_count
Option<usize>