Struct polars_arrow::array::FixedSizeListArray
source · pub struct FixedSizeListArray { /* private fields */ }
Expand description
The Arrow’s equivalent to an immutable Vec<Option<[T; size]>>
where T
is an Arrow type.
Cloning and slicing this struct is O(1)
.
Implementations§
source§impl<'a> FixedSizeListArray
impl<'a> FixedSizeListArray
sourcepub fn iter(
&'a self
) -> ZipValidity<Box<dyn Array>, ArrayValuesIter<'a, FixedSizeListArray>, BitmapIter<'a>> ⓘ
pub fn iter( &'a self ) -> ZipValidity<Box<dyn Array>, ArrayValuesIter<'a, FixedSizeListArray>, BitmapIter<'a>> ⓘ
Returns an iterator of Option<Box<dyn Array>>
sourcepub fn values_iter(&'a self) -> ArrayValuesIter<'a, FixedSizeListArray> ⓘ
pub fn values_iter(&'a self) -> ArrayValuesIter<'a, FixedSizeListArray> ⓘ
Returns an iterator of Box<dyn Array>
source§impl FixedSizeListArray
impl FixedSizeListArray
sourcepub fn try_new(
data_type: ArrowDataType,
values: Box<dyn Array>,
validity: Option<Bitmap>
) -> PolarsResult<Self>
pub fn try_new( data_type: ArrowDataType, values: Box<dyn Array>, validity: Option<Bitmap> ) -> PolarsResult<Self>
Creates a new FixedSizeListArray
.
§Errors
This function returns an error iff:
- The
data_type
’s physical type is notcrate::datatypes::PhysicalType::FixedSizeList
- The
data_type
’s inner field’s data type is not equal tovalues.data_type
. - The length of
values
is not a multiple ofsize
indata_type
- the validity’s length is not equal to
values.len() / size
.
sourcepub fn new(
data_type: ArrowDataType,
values: Box<dyn Array>,
validity: Option<Bitmap>
) -> Self
pub fn new( data_type: ArrowDataType, values: Box<dyn Array>, validity: Option<Bitmap> ) -> Self
Alias to Self::try_new(...).unwrap()
sourcepub const fn size(&self) -> usize
pub const fn size(&self) -> usize
Returns the size (number of elements per slot) of this FixedSizeListArray
.
sourcepub fn new_empty(data_type: ArrowDataType) -> Self
pub fn new_empty(data_type: ArrowDataType) -> Self
Returns a new empty FixedSizeListArray
.
sourcepub fn new_null(data_type: ArrowDataType, length: usize) -> Self
pub fn new_null(data_type: ArrowDataType, length: usize) -> Self
Returns a new null FixedSizeListArray
.
source§impl FixedSizeListArray
impl FixedSizeListArray
sourcepub fn slice(&mut self, offset: usize, length: usize)
pub fn slice(&mut self, offset: usize, length: usize)
Slices this FixedSizeListArray
.
§Implementation
This operation is O(1)
.
§Panics
panics iff offset + length > self.len()
sourcepub unsafe fn slice_unchecked(&mut self, offset: usize, length: usize)
pub unsafe fn slice_unchecked(&mut self, offset: usize, length: usize)
Slices this FixedSizeListArray
.
§Implementation
This operation is O(1)
.
§Safety
The caller must ensure that offset + length <= self.len()
.
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>
.
source§impl FixedSizeListArray
impl FixedSizeListArray
source§impl FixedSizeListArray
impl FixedSizeListArray
sourcepub fn default_datatype(data_type: ArrowDataType, size: usize) -> ArrowDataType
pub fn default_datatype(data_type: ArrowDataType, size: usize) -> ArrowDataType
Returns a ArrowDataType
consistent with FixedSizeListArray
.
Trait Implementations§
source§impl Array for FixedSizeListArray
impl Array for FixedSizeListArray
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 data_type(&self) -> &ArrowDataType
fn data_type(&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 slice_unchecked(&mut self, offset: usize, length: usize)
unsafe fn slice_unchecked(&mut self, offset: usize, length: usize)
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> ArrayAccessor<'a> for FixedSizeListArray
impl<'a> ArrayAccessor<'a> for FixedSizeListArray
source§impl ArrayFromIterDtype<Box<dyn Array>> for FixedSizeListArray
impl ArrayFromIterDtype<Box<dyn Array>> for FixedSizeListArray
fn arr_from_iter_with_dtype<I: IntoIterator<Item = Box<dyn Array>>>( dtype: ArrowDataType, iter: I ) -> Self
fn try_arr_from_iter_with_dtype<E, I: IntoIterator<Item = Result<Box<dyn Array>, 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 ArrayFromIterDtype<Option<Box<dyn Array>>> for FixedSizeListArray
impl ArrayFromIterDtype<Option<Box<dyn Array>>> for FixedSizeListArray
fn arr_from_iter_with_dtype<I: IntoIterator<Item = Option<Box<dyn Array>>>>( dtype: ArrowDataType, iter: I ) -> Self
fn try_arr_from_iter_with_dtype<E, I: IntoIterator<Item = Result<Option<Box<dyn Array>>, 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 Arrow2Arrow for FixedSizeListArray
impl Arrow2Arrow for FixedSizeListArray
source§impl Clone for FixedSizeListArray
impl Clone for FixedSizeListArray
source§fn clone(&self) -> FixedSizeListArray
fn clone(&self) -> FixedSizeListArray
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more