pub fn as_primitive_array<T: ArrowPrimitiveType>(
    array: &dyn Array
) -> Result<&PrimitiveArray<T>>