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>
source§impl<O: Offset> ListArray<O>
impl<O: Offset> ListArray<O>
sourcepub fn try_new(
data_type: DataType,
offsets: OffsetsBuffer<O>,
values: Box<dyn Array>,
validity: Option<Bitmap>
) -> Result<Self, Error>
pub fn try_new( data_type: DataType, offsets: OffsetsBuffer<O>, values: Box<dyn Array>, validity: Option<Bitmap> ) -> Result<Self, Error>
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
data_type
’scrate::datatypes::PhysicalType
is not equal to eithercrate::datatypes::PhysicalType::List
orcrate::datatypes::PhysicalType::LargeList
. - The
data_type
’s inner field’s data type is not equal tovalues.data_type
.
§Implementation
This function is O(1)
sourcepub fn new(
data_type: DataType,
offsets: OffsetsBuffer<O>,
values: Box<dyn Array>,
validity: Option<Bitmap>
) -> Self
pub fn new( data_type: DataType, 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
data_type
’scrate::datatypes::PhysicalType
is not equal to eithercrate::datatypes::PhysicalType::List
orcrate::datatypes::PhysicalType::LargeList
. - The
data_type
’s inner field’s data type is not equal tovalues.data_type
.
§Implementation
This function is O(1)
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 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<O: Offset> ListArray<O>
impl<O: Offset> ListArray<O>
source§impl<O: Offset> ListArray<O>
impl<O: Offset> ListArray<O>
sourcepub fn default_datatype(data_type: DataType) -> DataType
pub fn default_datatype(data_type: DataType) -> DataType
Returns a default DataType
: inner field is named “item” and is nullable
sourcepub fn get_child_field(data_type: &DataType) -> &Field
pub fn get_child_field(data_type: &DataType) -> &Field
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
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 data_type(&self) -> &DataType
fn data_type(&self) -> &DataType
The
DataType
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
Returns whether slot
i
is null. Read moresource§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
Converts to this type from the input type.
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
Converts to this type from the input type.
source§impl<'a, O: Offset> IntoIterator for &'a ListArray<O>
impl<'a, O: Offset> IntoIterator for &'a ListArray<O>
§type IntoIter = ZipValidity<Box<dyn Array>, ArrayValuesIter<'a, ListArray<O>>, BitmapIter<'a>>
type IntoIter = ZipValidity<Box<dyn Array>, ArrayValuesIter<'a, ListArray<O>>, BitmapIter<'a>>
Which kind of iterator are we turning this into?
source§impl<O: Offset> PartialEq<&(dyn Array + 'static)> for ListArray<O>
impl<O: Offset> PartialEq<&(dyn Array + 'static)> for ListArray<O>
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>
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
Mutably borrows from an owned value. Read more
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