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
sourceimpl<'a, O: Offset> ListArray<O>
impl<'a, O: Offset> ListArray<O>
sourcepub fn iter(
&'a self
) -> ZipValidity<'a, Box<dyn Array>, ListValuesIter<'a, ListArray<O>>>ⓘNotable traits for ZipValidity<'a, T, I>impl<'a, T, I: Iterator<Item = T>> Iterator for ZipValidity<'a, T, I> type Item = Option<T>;
pub fn iter(
&'a self
) -> ZipValidity<'a, Box<dyn Array>, ListValuesIter<'a, ListArray<O>>>ⓘNotable traits for ZipValidity<'a, T, I>impl<'a, T, I: Iterator<Item = T>> Iterator for ZipValidity<'a, T, I> type Item = Option<T>;
Returns an iterator of Option<Box<dyn Array>>
sourcepub fn values_iter(&'a self) -> ListValuesIter<'a, ListArray<O>>ⓘNotable traits for ListValuesIter<'a, A>impl<'a, A: IterableListArray> Iterator for ListValuesIter<'a, A> type Item = Box<dyn Array>;
pub fn values_iter(&'a self) -> ListValuesIter<'a, ListArray<O>>ⓘNotable traits for ListValuesIter<'a, A>impl<'a, A: IterableListArray> Iterator for ListValuesIter<'a, A> type Item = Box<dyn Array>;
Returns an iterator of Box<dyn Array>
sourceimpl<O: Offset> ListArray<O>
impl<O: Offset> ListArray<O>
sourcepub fn try_new(
data_type: DataType,
offsets: Buffer<O>,
values: Box<dyn Array>,
validity: Option<Bitmap>
) -> Result<Self, Error>
pub fn try_new(
data_type: DataType,
offsets: Buffer<O>,
values: Box<dyn Array>,
validity: Option<Bitmap>
) -> Result<Self, Error>
Creates a new ListArray
.
Errors
This function returns an error iff:
- the offsets are not monotonically increasing
- The last offset is not equal to the values’ length.
- the validity’s length is not equal to
offsets.len() - 1
. - 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(N)
- checking monotinicity is O(N)
sourcepub fn new(
data_type: DataType,
offsets: Buffer<O>,
values: Box<dyn Array>,
validity: Option<Bitmap>
) -> Self
pub fn new(
data_type: DataType,
offsets: Buffer<O>,
values: Box<dyn Array>,
validity: Option<Bitmap>
) -> Self
Creates a new ListArray
.
Panics
This function panics iff:
- the offsets are not monotonically increasing
- The last offset is not equal to the values’ length.
- the validity’s length is not equal to
offsets.len() - 1
. - 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(N)
- checking monotinicity is O(N)
sourcepub fn from_data(
data_type: DataType,
offsets: Buffer<O>,
values: Box<dyn Array>,
validity: Option<Bitmap>
) -> Self
pub fn from_data(
data_type: DataType,
offsets: Buffer<O>,
values: Box<dyn Array>,
validity: Option<Bitmap>
) -> Self
Alias of new
sourcepub fn boxed(self) -> Box<dyn Array>
pub fn boxed(self) -> Box<dyn Array>
Boxes self into a Box<dyn Array>
.
sourcepub fn arced(self) -> Arc<dyn Array>
pub fn arced(self) -> Arc<dyn Array>
Boxes self into a Arc<dyn Array>
.
sourceimpl<O: Offset> ListArray<O>
impl<O: Offset> ListArray<O>
sourcepub unsafe fn try_new_unchecked(
data_type: DataType,
offsets: Buffer<O>,
values: Box<dyn Array>,
validity: Option<Bitmap>
) -> Result<Self, Error>
pub unsafe fn try_new_unchecked(
data_type: DataType,
offsets: Buffer<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() - 1
. - 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
.
Safety
This function is unsafe iff:
- the offsets are not monotonically increasing
Implementation
This function is O(1)
sourcepub unsafe fn new_unchecked(
data_type: DataType,
offsets: Buffer<O>,
values: Box<dyn Array>,
validity: Option<Bitmap>
) -> Self
pub unsafe fn new_unchecked(
data_type: DataType,
offsets: Buffer<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() - 1
. - 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
.
Safety
This function is unsafe iff:
- the offsets are not monotonically increasing
Implementation
This function is O(1)
sourceimpl<O: Offset> ListArray<O>
impl<O: Offset> ListArray<O>
sourceimpl<O: Offset> ListArray<O>
impl<O: Offset> ListArray<O>
sourcepub unsafe fn value_unchecked(&self, i: usize) -> Box<dyn Array>
pub unsafe fn value_unchecked(&self, i: usize) -> Box<dyn Array>
sourceimpl<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
sourceimpl<O: Offset> Array for ListArray<O>
impl<O: Offset> Array for ListArray<O>
sourcefn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Converts itself to a reference of Any
, which enables downcasting to concrete types.
sourcefn 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.
sourcefn 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. Read more
sourcefn null_count(&self) -> usize
fn null_count(&self) -> usize
sourceimpl<'a, O: Offset> From<GrowableList<'a, O>> for ListArray<O>
impl<'a, O: Offset> From<GrowableList<'a, O>> for ListArray<O>
sourcefn from(val: GrowableList<'a, O>) -> Self
fn from(val: GrowableList<'a, O>) -> Self
Converts to this type from the input type.
sourceimpl<O: Offset, M: MutableArray> From<MutableListArray<O, M>> for ListArray<O>
impl<O: Offset, M: MutableArray> From<MutableListArray<O, M>> for ListArray<O>
sourcefn from(other: MutableListArray<O, M>) -> Self
fn from(other: MutableListArray<O, M>) -> Self
Converts to this type from the input type.
sourceimpl<'a, O: Offset> IntoIterator for &'a ListArray<O>
impl<'a, O: Offset> IntoIterator for &'a ListArray<O>
type IntoIter = ZipValidity<'a, Box<dyn Array + 'static, Global>, ListValuesIter<'a, ListArray<O>>>
type IntoIter = ZipValidity<'a, Box<dyn Array + 'static, Global>, ListValuesIter<'a, ListArray<O>>>
Which kind of iterator are we turning this into?
sourceimpl<O: Offset> IterableListArray for ListArray<O>
impl<O: Offset> IterableListArray for ListArray<O>
sourceimpl<O: Offset> PartialEq<&(dyn Array + 'static)> for ListArray<O>
impl<O: Offset> PartialEq<&(dyn Array + 'static)> for ListArray<O>
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more