use either::Either;
use crate::prelude::*;
impl<T: PolarsNumericType> ChunkedArray<T> {
pub fn to_vec(&self) -> Vec<Option<T::Native>> {
let mut buf = Vec::with_capacity(self.len());
for arr in self.downcast_iter() {
buf.extend(arr.into_iter().map(|v| v.copied()))
}
buf
}
pub fn to_vec_null_aware(&self) -> Either<Vec<T::Native>, Vec<Option<T::Native>>> {
if self.null_count() == 0 {
let mut buf = Vec::with_capacity(self.len());
for arr in self.downcast_iter() {
buf.extend_from_slice(arr.values())
}
Either::Left(buf)
} else {
Either::Right(self.to_vec())
}
}
}