pub struct ListArray<O: Offset> { /* private fields */ }
Expand description
An Array
semantically equivalent to Vec<Option<Vec<Option<T>>>>
with Arrow’s in-memory.
Implementations§
Source§impl<'a, O: Offset> ListArray<O>
impl<'a, O: Offset> ListArray<O>
Sourcepub fn iter(
&'a self,
) -> ZipValidity<Box<dyn Array>, ListValuesIter<'a, O>, BitmapIter<'a>> ⓘ
pub fn iter( &'a self, ) -> ZipValidity<Box<dyn Array>, ListValuesIter<'a, O>, BitmapIter<'a>> ⓘ
Returns an iterator of Option<Box<dyn Array>>
Sourcepub fn values_iter(&'a self) -> ListValuesIter<'a, O>
pub fn values_iter(&'a self) -> ListValuesIter<'a, O>
Returns an iterator of Box<dyn Array>
Sourcepub fn non_null_values_iter(&'a self) -> NonNullValuesIter<'a, ListArray<O>> ⓘ
pub fn non_null_values_iter(&'a self) -> NonNullValuesIter<'a, ListArray<O>> ⓘ
Returns an iterator of the non-null values Box<dyn Array>
.
Source§impl<O: Offset> ListArray<O>
impl<O: Offset> ListArray<O>
Sourcepub fn try_new(
dtype: ArrowDataType,
offsets: OffsetsBuffer<O>,
values: Box<dyn Array>,
validity: Option<Bitmap>,
) -> PolarsResult<Self>
pub fn try_new( dtype: ArrowDataType, offsets: OffsetsBuffer<O>, values: Box<dyn Array>, validity: Option<Bitmap>, ) -> PolarsResult<Self>
Creates a new ListArray
.
§Errors
This function returns an error iff:
- The last offset is not equal to the values’ length.
- the validity’s length is not equal to
offsets.len()
. - The
dtype
’scrate::datatypes::PhysicalType
is not equal to eithercrate::datatypes::PhysicalType::List
orcrate::datatypes::PhysicalType::LargeList
. - The
dtype
’s inner field’s data type is not equal tovalues.dtype
.
§Implementation
This function is O(1)
Sourcepub fn new(
dtype: ArrowDataType,
offsets: OffsetsBuffer<O>,
values: Box<dyn Array>,
validity: Option<Bitmap>,
) -> Self
pub fn new( dtype: ArrowDataType, offsets: OffsetsBuffer<O>, values: Box<dyn Array>, validity: Option<Bitmap>, ) -> Self
Creates a new ListArray
.
§Panics
This function panics iff:
- The last offset is not equal to the values’ length.
- the validity’s length is not equal to
offsets.len()
. - The
dtype
’scrate::datatypes::PhysicalType
is not equal to eithercrate::datatypes::PhysicalType::List
orcrate::datatypes::PhysicalType::LargeList
. - The
dtype
’s inner field’s data type is not equal tovalues.dtype
.
§Implementation
This function is O(1)
Sourcepub fn new_empty(dtype: ArrowDataType) -> Self
pub fn new_empty(dtype: ArrowDataType) -> Self
Returns a new empty ListArray
.
Sourcepub fn new_null(dtype: ArrowDataType, length: usize) -> Self
pub fn new_null(dtype: ArrowDataType, length: usize) -> Self
Returns a new null ListArray
.
Source§impl<O: Offset> ListArray<O>
impl<O: Offset> ListArray<O>
Sourcepub unsafe fn slice_unchecked(&mut self, offset: usize, length: usize)
pub unsafe fn slice_unchecked(&mut self, offset: usize, length: usize)
Sourcepub unsafe fn sliced_unchecked(self, offset: usize, length: usize) -> Self
pub unsafe fn sliced_unchecked(self, offset: usize, length: usize) -> Self
Sourcepub fn with_validity(self, validity: Option<Bitmap>) -> Self
pub fn with_validity(self, validity: Option<Bitmap>) -> Self
Sourcepub fn set_validity(&mut self, validity: Option<Bitmap>)
pub fn set_validity(&mut self, validity: Option<Bitmap>)
Sourcepub fn take_validity(&mut self) -> Option<Bitmap>
pub fn take_validity(&mut self) -> Option<Bitmap>
Takes the validity of this array, leaving it without a validity mask.
Sourcepub fn boxed(self) -> Box<dyn Array>
pub fn boxed(self) -> Box<dyn Array>
Boxes this array into a Box<dyn Array>
.
Sourcepub fn arced(self) -> Arc<dyn Array>
pub fn arced(self) -> Arc<dyn Array>
Arcs this array into a std::sync::Arc<dyn Array>
.
pub fn trim_to_normalized_offsets_recursive(&self) -> Self
Source§impl<O: Offset> ListArray<O>
impl<O: Offset> ListArray<O>
Source§impl<O: Offset> ListArray<O>
impl<O: Offset> ListArray<O>
Sourcepub fn default_datatype(dtype: ArrowDataType) -> ArrowDataType
pub fn default_datatype(dtype: ArrowDataType) -> ArrowDataType
Returns a default ArrowDataType
: inner field is named “item” and is nullable
Sourcepub fn get_child_field(dtype: &ArrowDataType) -> &Field
pub fn get_child_field(dtype: &ArrowDataType) -> &Field
Sourcepub fn try_get_child(dtype: &ArrowDataType) -> PolarsResult<&Field>
pub fn try_get_child(dtype: &ArrowDataType) -> PolarsResult<&Field>
Sourcepub fn get_child_type(dtype: &ArrowDataType) -> &ArrowDataType
pub fn get_child_type(dtype: &ArrowDataType) -> &ArrowDataType
Returns a the inner ArrowDataType
§Panics
Panics iff the logical type is not consistent with this struct.
Trait Implementations§
Source§impl<O: Offset> Array for ListArray<O>
impl<O: Offset> Array for ListArray<O>
Source§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Any
, which enables downcasting to concrete types.Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Any
, which enables mutable downcasting to concrete types.Source§fn len(&self) -> usize
fn len(&self) -> usize
Array
. Every array has a length corresponding to the number of
elements (slots).Source§fn dtype(&self) -> &ArrowDataType
fn dtype(&self) -> &ArrowDataType
ArrowDataType
of the Array
. In combination with Array::as_any
, this can be
used to downcast trait objects (dyn Array
) to concrete arrays.Source§unsafe fn split_at_boxed_unchecked(
&self,
offset: usize,
) -> (Box<dyn Array>, Box<dyn Array>)
unsafe fn split_at_boxed_unchecked( &self, offset: usize, ) -> (Box<dyn Array>, Box<dyn Array>)
Source§unsafe fn slice_unchecked(&mut self, offset: usize, length: usize)
unsafe fn slice_unchecked(&mut self, offset: usize, length: usize)
fn has_nulls(&self) -> bool
Source§unsafe fn is_null_unchecked(&self, i: usize) -> bool
unsafe fn is_null_unchecked(&self, i: usize) -> bool
i
is null. Read moreSource§impl<'a, O: Offset> ArrayAccessor<'a> for ListArray<O>
impl<'a, O: Offset> ArrayAccessor<'a> for ListArray<O>
Source§impl<T: AsArray> ArrayFromIter<Option<T>> for ListArray<i64>
impl<T: AsArray> ArrayFromIter<Option<T>> for ListArray<i64>
fn arr_from_iter<I: IntoIterator<Item = Option<T>>>(iter: I) -> Self
fn try_arr_from_iter<E, I: IntoIterator<Item = Result<Option<T>, E>>>( iter: I, ) -> Result<Self, E>
fn arr_from_iter_trusted<I>(iter: I) -> Self
fn try_arr_from_iter_trusted<E, I>(iter: I) -> Result<Self, E>
Source§impl<T: AsArray> ArrayFromIterDtype<Option<T>> for ListArray<i64>
impl<T: AsArray> ArrayFromIterDtype<Option<T>> for ListArray<i64>
fn arr_from_iter_with_dtype<I: IntoIterator<Item = Option<T>>>( dtype: ArrowDataType, iter: I, ) -> Self
fn try_arr_from_iter_with_dtype<E, I: IntoIterator<Item = Result<Option<T>, E>>>( dtype: ArrowDataType, iter: I, ) -> Result<Self, E>
fn arr_from_iter_trusted_with_dtype<I>(dtype: ArrowDataType, iter: I) -> Self
fn try_arr_from_iter_trusted_with_dtype<E, I>( dtype: ArrowDataType, iter: I, ) -> Result<Self, E>
Source§impl<T: AsArray> ArrayFromIterDtype<T> for ListArray<i64>
impl<T: AsArray> ArrayFromIterDtype<T> for ListArray<i64>
fn arr_from_iter_with_dtype<I: IntoIterator<Item = T>>( dtype: ArrowDataType, iter: I, ) -> Self
fn try_arr_from_iter_with_dtype<E, I: IntoIterator<Item = Result<T, E>>>( dtype: ArrowDataType, iter: I, ) -> Result<Self, E>
fn arr_from_iter_trusted_with_dtype<I>(dtype: ArrowDataType, iter: I) -> Self
fn try_arr_from_iter_trusted_with_dtype<E, I>( dtype: ArrowDataType, iter: I, ) -> Result<Self, E>
Source§impl<'a, O: Offset> From<GrowableList<'a, O>> for ListArray<O>
impl<'a, O: Offset> From<GrowableList<'a, O>> for ListArray<O>
Source§fn from(val: GrowableList<'a, O>) -> Self
fn from(val: GrowableList<'a, O>) -> Self
Source§impl<O: Offset, M: MutableArray> From<MutableListArray<O, M>> for ListArray<O>
impl<O: Offset, M: MutableArray> From<MutableListArray<O, M>> for ListArray<O>
Source§fn from(other: MutableListArray<O, M>) -> Self
fn from(other: MutableListArray<O, M>) -> Self
Source§impl<'a, O: Offset> IntoIterator for &'a ListArray<O>
impl<'a, O: Offset> IntoIterator for &'a ListArray<O>
Source§type IntoIter = ZipValidity<Box<dyn Array>, ArrayValuesIter<'a, ListArray<O>>, BitmapIter<'a>>
type IntoIter = ZipValidity<Box<dyn Array>, ArrayValuesIter<'a, ListArray<O>>, BitmapIter<'a>>
Source§impl ListFromIter for ListArray<i64>
impl ListFromIter for ListArray<i64>
Source§unsafe fn from_iter_primitive_trusted_len<T, P, I>(
iter: I,
dtype: ArrowDataType,
) -> ListArray<i64>
unsafe fn from_iter_primitive_trusted_len<T, P, I>( iter: I, dtype: ArrowDataType, ) -> ListArray<i64>
Source§unsafe fn from_iter_bool_trusted_len<I, P>(iter: I) -> ListArray<i64>
unsafe fn from_iter_bool_trusted_len<I, P>(iter: I) -> ListArray<i64>
Source§unsafe fn from_iter_binview_trusted_len<I, P, Ref, T: ViewType + ?Sized>(
iter: I,
n_elements: usize,
) -> ListArray<i64>
unsafe fn from_iter_binview_trusted_len<I, P, Ref, T: ViewType + ?Sized>( iter: I, n_elements: usize, ) -> ListArray<i64>
Source§unsafe fn from_iter_utf8_trusted_len<I, P, Ref>(
iter: I,
n_elements: usize,
) -> ListArray<i64>
unsafe fn from_iter_utf8_trusted_len<I, P, Ref>( iter: I, n_elements: usize, ) -> ListArray<i64>
Source§impl<O: Offset> Splitable for ListArray<O>
impl<O: Offset> Splitable for ListArray<O>
fn check_bound(&self, offset: usize) -> bool
Source§unsafe fn _split_at_unchecked(&self, offset: usize) -> (Self, Self)
unsafe fn _split_at_unchecked(&self, offset: usize) -> (Self, Self)
split_at_unchecked
. For any usage, prefer the using
split_at
or split_at_unchecked
. Read moreSource§impl StaticArray for ListArray<i64>
impl StaticArray for ListArray<i64>
type ValueT<'a> = Box<dyn Array>
type ZeroableValueT<'a> = Option<Box<dyn Array>>
type ValueIterT<'a> = ArrayValuesIter<'a, ListArray<i64>>
fn values_iter(&self) -> Self::ValueIterT<'_>
fn iter( &self, ) -> ZipValidity<Self::ValueT<'_>, Self::ValueIterT<'_>, BitmapIter<'_>> ⓘ
fn with_validity_typed(self, validity: Option<Bitmap>) -> Self
fn full_null(length: usize, dtype: ArrowDataType) -> Self
fn get(&self, idx: usize) -> Option<Self::ValueT<'_>>
fn last(&self) -> Option<Self::ValueT<'_>>
fn value(&self, idx: usize) -> Self::ValueT<'_>
fn as_slice(&self) -> Option<&[Self::ValueT<'_>]>
fn from_vec(v: Vec<Self::ValueT<'_>>, dtype: ArrowDataType) -> Self
fn from_zeroable_vec( v: Vec<Self::ZeroableValueT<'_>>, dtype: ArrowDataType, ) -> Self
fn full(length: usize, value: Self::ValueT<'_>, dtype: ArrowDataType) -> Self
Source§impl ValueSize for ListArray<i64>
impl ValueSize for ListArray<i64>
Source§fn get_values_size(&self) -> usize
fn get_values_size(&self) -> usize
impl ArrowArray for ListArray<i64>
Auto Trait Implementations§
impl<O> !Freeze for ListArray<O>
impl<O> !RefUnwindSafe for ListArray<O>
impl<O> Send for ListArray<O>
impl<O> Sync for ListArray<O>
impl<O> Unpin for ListArray<O>where
O: Unpin,
impl<O> !UnwindSafe for ListArray<O>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more