pub struct MapArray { /* private fields */ }
Expand description
An array representing a (key, value), both of arbitrary logical types.
Implementations§
Source§impl<'a> MapArray
impl<'a> MapArray
Sourcepub fn iter(
&'a self,
) -> ZipValidity<Box<dyn Array>, MapValuesIter<'a>, BitmapIter<'a>> ⓘ
pub fn iter( &'a self, ) -> ZipValidity<Box<dyn Array>, MapValuesIter<'a>, BitmapIter<'a>> ⓘ
Returns an iterator of Option<Box<dyn Array>>
Sourcepub fn values_iter(&'a self) -> MapValuesIter<'a>
pub fn values_iter(&'a self) -> MapValuesIter<'a>
Returns an iterator of Box<dyn Array>
Source§impl MapArray
impl MapArray
Sourcepub fn try_new(
dtype: ArrowDataType,
offsets: OffsetsBuffer<i32>,
field: Box<dyn Array>,
validity: Option<Bitmap>,
) -> PolarsResult<Self>
pub fn try_new( dtype: ArrowDataType, offsets: OffsetsBuffer<i32>, field: Box<dyn Array>, validity: Option<Bitmap>, ) -> PolarsResult<Self>
Returns a new MapArray
.
§Errors
This function errors iff:
- The last offset is not equal to the field’ length
- The
dtype
’s physical type is notcrate::datatypes::PhysicalType::Map
- The fields’
dtype
is not equal to the inner field ofdtype
- The validity is not
None
and its length is different fromoffsets.len() - 1
.
Sourcepub fn new(
dtype: ArrowDataType,
offsets: OffsetsBuffer<i32>,
field: Box<dyn Array>,
validity: Option<Bitmap>,
) -> Self
pub fn new( dtype: ArrowDataType, offsets: OffsetsBuffer<i32>, field: Box<dyn Array>, validity: Option<Bitmap>, ) -> Self
Creates a new MapArray
.
§Panics
- The last offset is not equal to the field’ length.
- The
dtype
’s physical type is notcrate::datatypes::PhysicalType::Map
, - The validity is not
None
and its length is different fromoffsets.len() - 1
.
Sourcepub fn new_null(dtype: ArrowDataType, length: usize) -> Self
pub fn new_null(dtype: ArrowDataType, length: usize) -> Self
Returns a new null MapArray
of length
.
Sourcepub fn new_empty(dtype: ArrowDataType) -> Self
pub fn new_empty(dtype: ArrowDataType) -> Self
Returns a new empty MapArray
.
Source§impl MapArray
impl MapArray
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>
.
Trait Implementations§
Source§impl Array for MapArray
impl Array for MapArray
Source§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Converts itself to a reference of
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
Converts itself to a mutable reference of
Any
, which enables mutable downcasting to concrete types.Source§fn len(&self) -> usize
fn len(&self) -> usize
The length of the
Array
. Every array has a length corresponding to the number of
elements (slots).Source§fn dtype(&self) -> &ArrowDataType
fn dtype(&self) -> &ArrowDataType
The
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
Returns whether slot
i
is null. Read moreSource§impl<'a> IntoIterator for &'a MapArray
impl<'a> IntoIterator for &'a MapArray
Source§type IntoIter = ZipValidity<Box<dyn Array>, MapValuesIter<'a>, BitmapIter<'a>>
type IntoIter = ZipValidity<Box<dyn Array>, MapValuesIter<'a>, BitmapIter<'a>>
Which kind of iterator are we turning this into?
Source§impl Splitable for MapArray
impl Splitable for MapArray
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)
Internal implementation of
split_at_unchecked
. For any usage, prefer the using
split_at
or split_at_unchecked
. Read moreAuto Trait Implementations§
impl !Freeze for MapArray
impl !RefUnwindSafe for MapArray
impl Send for MapArray
impl Sync for MapArray
impl Unpin for MapArray
impl !UnwindSafe for MapArray
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
Mutably borrows from an owned value. Read more
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)
🔬This is a nightly-only experimental API. (
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> ⓘ
Converts
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> ⓘ
Converts
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