pub struct MapArray { /* private fields */ }
Expand description
An array of key-value maps
Keys should always be non-null, but values can be null.
MapArray
is physically a ListArray
of key values pairs stored as an entries
StructArray
with 2 child fields.
See MapBuilder
for how to construct a MapArray
Implementations§
Source§impl MapArray
impl MapArray
Sourcepub fn try_new(
field: Arc<Field>,
offsets: OffsetBuffer<i32>,
entries: StructArray,
nulls: Option<NullBuffer>,
ordered: bool,
) -> Result<MapArray, ArrowError>
pub fn try_new( field: Arc<Field>, offsets: OffsetBuffer<i32>, entries: StructArray, nulls: Option<NullBuffer>, ordered: bool, ) -> Result<MapArray, ArrowError>
Create a new MapArray
from the provided parts
See MapBuilder
for a higher-level interface
to construct a MapArray
§Errors
Errors if
offsets.len() - 1 != nulls.len()
offsets.last() > entries.len()
field.is_nullable()
entries.null_count() != 0
entries.columns().len() != 2
field.data_type() != entries.data_type()
Sourcepub fn new(
field: Arc<Field>,
offsets: OffsetBuffer<i32>,
entries: StructArray,
nulls: Option<NullBuffer>,
ordered: bool,
) -> MapArray
pub fn new( field: Arc<Field>, offsets: OffsetBuffer<i32>, entries: StructArray, nulls: Option<NullBuffer>, ordered: bool, ) -> MapArray
Create a new MapArray
from the provided parts
See MapBuilder
for a higher-level interface
to construct a MapArray
§Panics
Panics if Self::try_new
returns an error
Sourcepub fn into_parts(
self,
) -> (Arc<Field>, OffsetBuffer<i32>, StructArray, Option<NullBuffer>, bool)
pub fn into_parts( self, ) -> (Arc<Field>, OffsetBuffer<i32>, StructArray, Option<NullBuffer>, bool)
Deconstruct this array into its constituent parts
Sourcepub fn offsets(&self) -> &OffsetBuffer<i32>
pub fn offsets(&self) -> &OffsetBuffer<i32>
Returns a reference to the offsets of this map
Unlike Self::value_offsets
this returns the OffsetBuffer
allowing for zero-copy cloning
Sourcepub fn entries(&self) -> &StructArray
pub fn entries(&self) -> &StructArray
Returns a reference to the StructArray
entries of this map
Sourcepub fn value_type(&self) -> &DataType
pub fn value_type(&self) -> &DataType
Returns the data type of the map’s values.
Sourcepub unsafe fn value_unchecked(&self, i: usize) -> StructArray
pub unsafe fn value_unchecked(&self, i: usize) -> StructArray
Returns ith value of this map array.
§Safety
Caller must ensure that the index is within the array bounds
Sourcepub fn value(&self, i: usize) -> StructArray
pub fn value(&self, i: usize) -> StructArray
Returns ith value of this map array.
This is a StructArray
containing two fields
Sourcepub fn value_offsets(&self) -> &[i32]
pub fn value_offsets(&self) -> &[i32]
Returns the offset values in the offsets buffer
Sourcepub fn value_length(&self, i: usize) -> i32
pub fn value_length(&self, i: usize) -> i32
Returns the length for value at index i
.
Trait Implementations§
Source§impl Array for MapArray
impl Array for MapArray
Source§fn slice(&self, offset: usize, length: usize) -> Arc<dyn Array>
fn slice(&self, offset: usize, length: usize) -> Arc<dyn Array>
Source§fn shrink_to_fit(&mut self)
fn shrink_to_fit(&mut self)
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 ArrayAccessor for &MapArray
impl ArrayAccessor for &MapArray
Source§type Item = StructArray
type Item = StructArray
Source§fn value(&self, index: usize) -> <&MapArray as ArrayAccessor>::Item
fn value(&self, index: usize) -> <&MapArray as ArrayAccessor>::Item
i
Read moreSource§unsafe fn value_unchecked(
&self,
index: usize,
) -> <&MapArray as ArrayAccessor>::Item
unsafe fn value_unchecked( &self, index: usize, ) -> <&MapArray as ArrayAccessor>::Item
i
Read moreSource§impl EngineMap for MapArray
impl EngineMap for MapArray
Source§impl<'a> GetData<'a> for MapArray
impl<'a> GetData<'a> for MapArray
fn get_map( &'a self, row_index: usize, _field_name: &str, ) -> Result<Option<MapItem<'a>>, Error>
fn get_bool( &'a self, _row_index: usize, field_name: &str, ) -> Result<Option<bool>, Error>
fn get_int( &'a self, _row_index: usize, field_name: &str, ) -> Result<Option<i32>, Error>
fn get_long( &'a self, _row_index: usize, field_name: &str, ) -> Result<Option<i64>, Error>
fn get_str( &'a self, _row_index: usize, field_name: &str, ) -> Result<Option<&'a str>, Error>
fn get_list( &'a self, _row_index: usize, field_name: &str, ) -> Result<Option<ListItem<'a>>, Error>
Auto Trait Implementations§
impl Freeze for MapArray
impl !RefUnwindSafe for MapArray
impl Send for MapArray
impl Sync for MapArray
impl Unpin for MapArray
impl !UnwindSafe for MapArray
Blanket Implementations§
Source§impl<T> AsAny for T
impl<T> AsAny for T
Source§fn any_ref(&self) -> &(dyn Any + Sync + Send + 'static)
fn any_ref(&self) -> &(dyn Any + Sync + Send + 'static)
dyn Any
reference to the object: Read moreSource§fn as_any(self: Arc<T>) -> Arc<dyn Any + Sync + Send>
fn as_any(self: Arc<T>) -> Arc<dyn Any + Sync + Send>
Arc<dyn Any>
reference to the object: Read moreSource§fn into_any(self: Box<T>) -> Box<dyn Any + Sync + Send>
fn into_any(self: Box<T>) -> Box<dyn Any + Sync + Send>
Box<dyn Any>
: Read moreSource§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
std::any::type_name
, since Any
does not provide it and
Any::type_id
is useless as a debugging aid (its Debug
is just a mess of hex digits).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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more