Struct arrow::array::GenericListViewArray
source · pub struct GenericListViewArray<OffsetSize>where
OffsetSize: OffsetSizeTrait,{ /* private fields */ }
Expand description
Different from crate::GenericListArray
as it stores both an offset and length
meaning that take / filter operations can be implemented without copying the underlying data.
Implementations§
source§impl<OffsetSize> GenericListViewArray<OffsetSize>where
OffsetSize: OffsetSizeTrait,
impl<OffsetSize> GenericListViewArray<OffsetSize>where
OffsetSize: OffsetSizeTrait,
sourcepub const DATA_TYPE_CONSTRUCTOR: fn(_: Arc<Field>) -> DataType = _
pub const DATA_TYPE_CONSTRUCTOR: fn(_: Arc<Field>) -> DataType = _
The data type constructor of listview array.
The input is the schema of the child array and
the output is the DataType
, ListView or LargeListView.
sourcepub fn try_new(
field: Arc<Field>,
offsets: ScalarBuffer<OffsetSize>,
sizes: ScalarBuffer<OffsetSize>,
values: Arc<dyn Array>,
nulls: Option<NullBuffer>,
) -> Result<GenericListViewArray<OffsetSize>, ArrowError>
pub fn try_new( field: Arc<Field>, offsets: ScalarBuffer<OffsetSize>, sizes: ScalarBuffer<OffsetSize>, values: Arc<dyn Array>, nulls: Option<NullBuffer>, ) -> Result<GenericListViewArray<OffsetSize>, ArrowError>
Create a new GenericListViewArray
from the provided parts
§Errors
Errors if
offsets.len() != sizes.len()
offsets.len() != nulls.len()
offsets[i] > values.len()
!field.is_nullable() && values.is_nullable()
field.data_type() != values.data_type()
0 <= offsets[i] <= length of the child array
0 <= offsets[i] + size[i] <= length of the child array
sourcepub fn new(
field: Arc<Field>,
offsets: ScalarBuffer<OffsetSize>,
sizes: ScalarBuffer<OffsetSize>,
values: Arc<dyn Array>,
nulls: Option<NullBuffer>,
) -> GenericListViewArray<OffsetSize>
pub fn new( field: Arc<Field>, offsets: ScalarBuffer<OffsetSize>, sizes: ScalarBuffer<OffsetSize>, values: Arc<dyn Array>, nulls: Option<NullBuffer>, ) -> GenericListViewArray<OffsetSize>
Create a new GenericListViewArray
from the provided parts
§Panics
Panics if Self::try_new
returns an error
sourcepub fn new_null(
field: Arc<Field>,
len: usize,
) -> GenericListViewArray<OffsetSize>
pub fn new_null( field: Arc<Field>, len: usize, ) -> GenericListViewArray<OffsetSize>
Create a new GenericListViewArray
of length len
where all values are null
sourcepub fn into_parts(
self,
) -> (Arc<Field>, ScalarBuffer<OffsetSize>, ScalarBuffer<OffsetSize>, Arc<dyn Array>, Option<NullBuffer>)
pub fn into_parts( self, ) -> (Arc<Field>, ScalarBuffer<OffsetSize>, ScalarBuffer<OffsetSize>, Arc<dyn Array>, Option<NullBuffer>)
Deconstruct this array into its constituent parts
sourcepub fn offsets(&self) -> &ScalarBuffer<OffsetSize>
pub fn offsets(&self) -> &ScalarBuffer<OffsetSize>
Returns a reference to the offsets of this list
Unlike Self::value_offsets
this returns the ScalarBuffer
allowing for zero-copy cloning
sourcepub fn sizes(&self) -> &ScalarBuffer<OffsetSize>
pub fn sizes(&self) -> &ScalarBuffer<OffsetSize>
Returns a reference to the sizes of this list
Unlike Self::value_sizes
this returns the ScalarBuffer
allowing for zero-copy cloning
sourcepub fn value_type(&self) -> DataType
pub fn value_type(&self) -> DataType
Returns a clone of the value type of this list.
sourcepub unsafe fn value_unchecked(&self, i: usize) -> Arc<dyn Array>
pub unsafe fn value_unchecked(&self, i: usize) -> Arc<dyn Array>
Returns ith value of this list view array.
§Safety
Caller must ensure that the index is within the array bounds
sourcepub fn value_offsets(&self) -> &[OffsetSize]
pub fn value_offsets(&self) -> &[OffsetSize]
Returns the offset values in the offsets buffer
sourcepub fn value_sizes(&self) -> &[OffsetSize]
pub fn value_sizes(&self) -> &[OffsetSize]
Returns the sizes values in the offsets buffer
sourcepub fn value_size(&self, i: usize) -> OffsetSize
pub fn value_size(&self, i: usize) -> OffsetSize
Returns the size for value at index i
.
sourcepub fn value_offset(&self, i: usize) -> OffsetSize
pub fn value_offset(&self, i: usize) -> OffsetSize
Returns the offset for value at index i
.
sourcepub fn iter(&self) -> ArrayIter<&GenericListViewArray<OffsetSize>> ⓘ
pub fn iter(&self) -> ArrayIter<&GenericListViewArray<OffsetSize>> ⓘ
Constructs a new iterator
sourcepub fn slice(
&self,
offset: usize,
length: usize,
) -> GenericListViewArray<OffsetSize>
pub fn slice( &self, offset: usize, length: usize, ) -> GenericListViewArray<OffsetSize>
Returns a zero-copy slice of this array with the indicated offset and length.
Trait Implementations§
source§impl<OffsetSize> Array for GenericListViewArray<OffsetSize>where
OffsetSize: OffsetSizeTrait,
impl<OffsetSize> Array for GenericListViewArray<OffsetSize>where
OffsetSize: OffsetSizeTrait,
source§fn slice(&self, offset: usize, length: usize) -> Arc<dyn Array>
fn slice(&self, offset: usize, length: usize) -> Arc<dyn Array>
source§fn offset(&self) -> usize
fn offset(&self) -> usize
0
. Read moresource§fn nulls(&self) -> Option<&NullBuffer>
fn nulls(&self) -> Option<&NullBuffer>
source§fn logical_null_count(&self) -> usize
fn logical_null_count(&self) -> usize
source§fn get_buffer_memory_size(&self) -> usize
fn get_buffer_memory_size(&self) -> usize
source§fn get_array_memory_size(&self) -> usize
fn get_array_memory_size(&self) -> usize
get_buffer_memory_size()
and
includes the overhead of the data structures that contain the pointers to the various buffers.source§fn logical_nulls(&self) -> Option<NullBuffer>
fn logical_nulls(&self) -> Option<NullBuffer>
NullBuffer
that represents the logical
null values of this array, if any. Read moresource§fn null_count(&self) -> usize
fn null_count(&self) -> usize
source§fn is_nullable(&self) -> bool
fn is_nullable(&self) -> bool
false
if the array is guaranteed to not contain any logical nulls Read moresource§impl<OffsetSize> ArrayAccessor for &GenericListViewArray<OffsetSize>where
OffsetSize: OffsetSizeTrait,
impl<OffsetSize> ArrayAccessor for &GenericListViewArray<OffsetSize>where
OffsetSize: OffsetSizeTrait,
source§fn value(
&self,
index: usize,
) -> <&GenericListViewArray<OffsetSize> as ArrayAccessor>::Item
fn value( &self, index: usize, ) -> <&GenericListViewArray<OffsetSize> as ArrayAccessor>::Item
i
Read moresource§unsafe fn value_unchecked(
&self,
index: usize,
) -> <&GenericListViewArray<OffsetSize> as ArrayAccessor>::Item
unsafe fn value_unchecked( &self, index: usize, ) -> <&GenericListViewArray<OffsetSize> as ArrayAccessor>::Item
i
Read moresource§impl<OffsetSize> Clone for GenericListViewArray<OffsetSize>where
OffsetSize: Clone + OffsetSizeTrait,
impl<OffsetSize> Clone for GenericListViewArray<OffsetSize>where
OffsetSize: Clone + OffsetSizeTrait,
source§fn clone(&self) -> GenericListViewArray<OffsetSize>
fn clone(&self) -> GenericListViewArray<OffsetSize>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<OffsetSize> Debug for GenericListViewArray<OffsetSize>where
OffsetSize: OffsetSizeTrait,
impl<OffsetSize> Debug for GenericListViewArray<OffsetSize>where
OffsetSize: OffsetSizeTrait,
source§impl<OffsetSize> From<ArrayData> for GenericListViewArray<OffsetSize>where
OffsetSize: OffsetSizeTrait,
impl<OffsetSize> From<ArrayData> for GenericListViewArray<OffsetSize>where
OffsetSize: OffsetSizeTrait,
source§fn from(data: ArrayData) -> GenericListViewArray<OffsetSize>
fn from(data: ArrayData) -> GenericListViewArray<OffsetSize>
source§impl<OffsetSize> From<FixedSizeListArray> for GenericListViewArray<OffsetSize>where
OffsetSize: OffsetSizeTrait,
impl<OffsetSize> From<FixedSizeListArray> for GenericListViewArray<OffsetSize>where
OffsetSize: OffsetSizeTrait,
source§fn from(value: FixedSizeListArray) -> GenericListViewArray<OffsetSize>
fn from(value: FixedSizeListArray) -> GenericListViewArray<OffsetSize>
source§impl<OffsetSize> From<GenericListViewArray<OffsetSize>> for ArrayDatawhere
OffsetSize: OffsetSizeTrait,
impl<OffsetSize> From<GenericListViewArray<OffsetSize>> for ArrayDatawhere
OffsetSize: OffsetSizeTrait,
source§fn from(array: GenericListViewArray<OffsetSize>) -> ArrayData
fn from(array: GenericListViewArray<OffsetSize>) -> ArrayData
source§impl<OffsetSize> PartialEq for GenericListViewArray<OffsetSize>where
OffsetSize: OffsetSizeTrait,
impl<OffsetSize> PartialEq for GenericListViewArray<OffsetSize>where
OffsetSize: OffsetSizeTrait,
source§fn eq(&self, other: &GenericListViewArray<OffsetSize>) -> bool
fn eq(&self, other: &GenericListViewArray<OffsetSize>) -> bool
self
and other
values to be equal, and is used by ==
.Auto Trait Implementations§
impl<OffsetSize> Freeze for GenericListViewArray<OffsetSize>
impl<OffsetSize> !RefUnwindSafe for GenericListViewArray<OffsetSize>
impl<OffsetSize> Send for GenericListViewArray<OffsetSize>
impl<OffsetSize> Sync for GenericListViewArray<OffsetSize>
impl<OffsetSize> Unpin for GenericListViewArray<OffsetSize>where
OffsetSize: Unpin,
impl<OffsetSize> !UnwindSafe for GenericListViewArray<OffsetSize>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)