pub struct ListArray<O> where
O: Offset, { /* private fields */ }
Expand description
An Array
semantically equivalent to Vec<Option<Vec<Option<T>>>>
with Arrow’s in-memory.
Implementations
impl<'a, O> ListArray<O> where
O: Offset,
impl<'a, O> ListArray<O> where
O: Offset,
pub fn iter(
&'a self
) -> ZipValidity<'a, Box<dyn Array + 'static, Global>, ListValuesIter<'a, ListArray<O>>>ⓘNotable traits for ZipValidity<'a, T, I>impl<'a, T, I> Iterator for ZipValidity<'a, T, I> where
I: Iterator<Item = T>, type Item = Option<T>;
pub fn iter(
&'a self
) -> ZipValidity<'a, Box<dyn Array + 'static, Global>, ListValuesIter<'a, ListArray<O>>>ⓘNotable traits for ZipValidity<'a, T, I>impl<'a, T, I> Iterator for ZipValidity<'a, T, I> where
I: Iterator<Item = T>, type Item = Option<T>;
I: Iterator<Item = T>, type Item = Option<T>;
Returns an iterator of Option<Box<dyn Array>>
pub fn values_iter(&'a self) -> ListValuesIter<'a, ListArray<O>>ⓘNotable traits for ListValuesIter<'a, A>impl<'a, A> Iterator for ListValuesIter<'a, A> where
A: IterableListArray, type Item = Box<dyn Array + 'static, Global>;
pub fn values_iter(&'a self) -> ListValuesIter<'a, ListArray<O>>ⓘNotable traits for ListValuesIter<'a, A>impl<'a, A> Iterator for ListValuesIter<'a, A> where
A: IterableListArray, type Item = Box<dyn Array + 'static, Global>;
A: IterableListArray, type Item = Box<dyn Array + 'static, Global>;
Returns an iterator of Box<dyn Array>
impl<O> ListArray<O> where
O: Offset,
impl<O> ListArray<O> where
O: Offset,
pub fn try_new(
data_type: DataType,
offsets: Buffer<O>,
values: Arc<dyn Array + 'static>,
validity: Option<Bitmap>
) -> Result<ListArray<O>, ArrowError>
pub fn try_new(
data_type: DataType,
offsets: Buffer<O>,
values: Arc<dyn Array + 'static>,
validity: Option<Bitmap>
) -> Result<ListArray<O>, 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)
pub fn new(
data_type: DataType,
offsets: Buffer<O>,
values: Arc<dyn Array + 'static>,
validity: Option<Bitmap>
) -> ListArray<O>
pub fn new(
data_type: DataType,
offsets: Buffer<O>,
values: Arc<dyn Array + 'static>,
validity: Option<Bitmap>
) -> ListArray<O>
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)
impl<O> ListArray<O> where
O: Offset,
impl<O> ListArray<O> where
O: Offset,
pub unsafe fn try_new_unchecked(
data_type: DataType,
offsets: Buffer<O>,
values: Arc<dyn Array + 'static>,
validity: Option<Bitmap>
) -> Result<ListArray<O>, ArrowError>
pub unsafe fn try_new_unchecked(
data_type: DataType,
offsets: Buffer<O>,
values: Arc<dyn Array + 'static>,
validity: Option<Bitmap>
) -> Result<ListArray<O>, 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)
pub unsafe fn new_unchecked(
data_type: DataType,
offsets: Buffer<O>,
values: Arc<dyn Array + 'static>,
validity: Option<Bitmap>
) -> ListArray<O>
pub unsafe fn new_unchecked(
data_type: DataType,
offsets: Buffer<O>,
values: Arc<dyn Array + 'static>,
validity: Option<Bitmap>
) -> ListArray<O>
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)
impl<O> ListArray<O> where
O: Offset,
impl<O> ListArray<O> where
O: Offset,
impl<O> ListArray<O> where
O: Offset,
impl<O> ListArray<O> where
O: Offset,
pub unsafe fn value_unchecked(
&self,
i: usize
) -> Box<dyn Array + 'static, Global>
pub unsafe fn value_unchecked(
&self,
i: usize
) -> Box<dyn Array + 'static, Global>
impl<O> ListArray<O> where
O: Offset,
impl<O> ListArray<O> where
O: Offset,
pub 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
pub fn get_child_field(data_type: &DataType) -> &Field
pub fn get_child_field(data_type: &DataType) -> &Field
pub fn get_child_type(data_type: &DataType) -> &DataType
pub fn get_child_type(data_type: &DataType) -> &DataType
Trait Implementations
impl<O> Array for ListArray<O> where
O: Offset,
impl<O> Array for ListArray<O> where
O: Offset,
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. Read more
fn to_boxed(&self) -> Box<dyn Array + 'static, Global>
fn to_boxed(&self) -> Box<dyn Array + 'static, Global>
Clone a &dyn Array
to an owned Box<dyn Array>
.
fn null_count(&self) -> usize
fn null_count(&self) -> usize
impl ArrowGetItem for ListArray<i64>
impl ArrowGetItem for ListArray<i64>
impl<'a, O> From<GrowableList<'a, O>> for ListArray<O> where
O: Offset,
impl<'a, O> From<GrowableList<'a, O>> for ListArray<O> where
O: Offset,
fn from(val: GrowableList<'a, O>) -> ListArray<O>
fn from(val: GrowableList<'a, O>) -> ListArray<O>
Converts to this type from the input type.
impl<O, M> From<MutableListArray<O, M>> for ListArray<O> where
O: Offset,
M: MutableArray,
impl<O, M> From<MutableListArray<O, M>> for ListArray<O> where
O: Offset,
M: MutableArray,
fn from(other: MutableListArray<O, M>) -> ListArray<O>
fn from(other: MutableListArray<O, M>) -> ListArray<O>
Converts to this type from the input type.
impl<'a, O> IntoIterator for &'a ListArray<O> where
O: Offset,
impl<'a, O> IntoIterator for &'a ListArray<O> where
O: Offset,
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?
fn into_iter(self) -> <&'a ListArray<O> as IntoIterator>::IntoIter
fn into_iter(self) -> <&'a ListArray<O> as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
impl<O> IterableListArray for ListArray<O> where
O: Offset,
impl<O> IterableListArray for ListArray<O> where
O: Offset,
impl ListFromIter for ListArray<i64>
impl ListFromIter for ListArray<i64>
unsafe fn from_iter_primitive_trusted_len<T, P, I>(
iter: I,
data_type: DataType
) -> ListArray<i64> where
T: NativeType,
P: IntoIterator<Item = Option<T>>,
I: IntoIterator<Item = Option<P>>,
unsafe fn from_iter_primitive_trusted_len<T, P, I>(
iter: I,
data_type: DataType
) -> ListArray<i64> where
T: NativeType,
P: IntoIterator<Item = Option<T>>,
I: IntoIterator<Item = Option<P>>,
Create a list-array from an iterator. Used in groupby agg-list Read more
unsafe fn from_iter_bool_trusted_len<I, P>(iter: I) -> ListArray<i64> where
I: IntoIterator<Item = Option<P>>,
P: IntoIterator<Item = Option<bool>>,
unsafe fn from_iter_bool_trusted_len<I, P>(iter: I) -> ListArray<i64> where
I: IntoIterator<Item = Option<P>>,
P: IntoIterator<Item = Option<bool>>,
Create a list-array from an iterator. Used in groupby agg-list Read more
unsafe fn from_iter_utf8_trusted_len<I, P, Ref>(
iter: I,
n_elements: usize
) -> ListArray<i64> where
I: IntoIterator<Item = Option<P>>,
P: IntoIterator<Item = Option<Ref>>,
Ref: AsRef<str>,
unsafe fn from_iter_utf8_trusted_len<I, P, Ref>(
iter: I,
n_elements: usize
) -> ListArray<i64> where
I: IntoIterator<Item = Option<P>>,
P: IntoIterator<Item = Option<Ref>>,
Ref: AsRef<str>,
Create a list-array from an iterator. Used in groupby agg-list Read more
impl ValueSize for ListArray<i64>
impl ValueSize for ListArray<i64>
fn get_values_size(&self) -> usize
fn get_values_size(&self) -> usize
Useful for a Utf8 or a List to get underlying value size. During a rechunk this is handy Read more
impl ArrowArray for ListArray<i64>
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
impl<A> IsValid for A where
A: ArrowArray,
impl<A> IsValid for A where
A: ArrowArray,
unsafe fn is_valid_unchecked(&self, i: usize) -> bool
unsafe fn is_valid_unchecked(&self, i: usize) -> bool
Safety Read more
unsafe fn is_null_unchecked(&self, i: usize) -> bool
unsafe fn is_null_unchecked(&self, i: usize) -> bool
Safety Read more
impl<T> Pointable for T
impl<T> Pointable for T
impl<A> PolarsArray for A where
A: Array + ?Sized,
impl<A> PolarsArray for A where
A: Array + ?Sized,
fn has_validity(&self) -> bool
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