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: Arc<dyn Array>,
validity: Option<Bitmap>
) -> Result<Self, ArrowError>
pub fn try_new(
data_type: DataType,
offsets: Buffer<O>,
values: Arc<dyn Array>,
validity: Option<Bitmap>
) -> Result<Self, ArrowError>
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: Arc<dyn Array>,
validity: Option<Bitmap>
) -> Self
pub fn new(
data_type: DataType,
offsets: Buffer<O>,
values: Arc<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)
sourceimpl<O: Offset> ListArray<O>
impl<O: Offset> ListArray<O>
sourcepub unsafe fn try_new_unchecked(
data_type: DataType,
offsets: Buffer<O>,
values: Arc<dyn Array>,
validity: Option<Bitmap>
) -> Result<Self, ArrowError>
pub unsafe fn try_new_unchecked(
data_type: DataType,
offsets: Buffer<O>,
values: Arc<dyn Array>,
validity: Option<Bitmap>
) -> Result<Self, ArrowError>
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: Arc<dyn Array>,
validity: Option<Bitmap>
) -> Self
pub unsafe fn new_unchecked(
data_type: DataType,
offsets: Buffer<O>,
values: Arc<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>
Trait Implementations
sourceimpl<O: Offset> Array for ListArray<O>
impl<O: Offset> Array for ListArray<O>
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
Performs the conversion.
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
Performs the conversion.
sourceimpl<'a, O: Offset> IntoIterator for &'a ListArray<O>
impl<'a, O: Offset> IntoIterator for &'a ListArray<O>
sourceimpl<O: Offset> IterableListArray for ListArray<O>
impl<O: Offset> IterableListArray 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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more