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)
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>
.
source§impl<O: Offset> ListArray<O>
impl<O: Offset> ListArray<O>
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§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 + 'static, Global>, ArrayValuesIter<'a, ListArray<O>>, BitmapIter<'a>>
type IntoIter = ZipValidity<Box<dyn Array + 'static, Global>, ArrayValuesIter<'a, ListArray<O>>, BitmapIter<'a>>
Which kind of iterator are we turning this into?