Struct MapArray
pub struct MapArray {
data_type: DataType,
nulls: Option<NullBuffer>,
entries: StructArray,
value_offsets: OffsetBuffer<i32>,
}
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
Fields§
§data_type: DataType
§nulls: Option<NullBuffer>
§entries: StructArray
§value_offsets: OffsetBuffer<i32>
Implementations§
§impl MapArray
impl MapArray
pub 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()
pub 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
pub 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
pub 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
pub fn entries(&self) -> &StructArray
pub fn entries(&self) -> &StructArray
Returns a reference to the StructArray
entries of this map
pub fn value_type(&self) -> &DataType
pub fn value_type(&self) -> &DataType
Returns the data type of the map’s values.
pub 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
pub 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
pub fn value_offsets(&self) -> &[i32]
pub fn value_offsets(&self) -> &[i32]
Returns the offset values in the offsets buffer
pub fn value_length(&self, i: usize) -> i32
pub fn value_length(&self, i: usize) -> i32
Returns the length for value at index i
.
§impl MapArray
impl MapArray
pub fn new_from_strings<'a>(
keys: impl Iterator<Item = &'a str>,
values: &dyn Array,
entry_offsets: &[u32],
) -> Result<MapArray, ArrowError>
pub fn new_from_strings<'a>( keys: impl Iterator<Item = &'a str>, values: &dyn Array, entry_offsets: &[u32], ) -> Result<MapArray, ArrowError>
Creates map array from provided keys, values and entry_offsets.
Trait Implementations§
§impl ArrayAccessor for &MapArray
impl ArrayAccessor for &MapArray
§type Item = StructArray
type Item = StructArray
§fn value(&self, index: usize) -> <&MapArray as ArrayAccessor>::Item
fn value(&self, index: usize) -> <&MapArray as ArrayAccessor>::Item
i
Read more§unsafe fn value_unchecked(
&self,
index: usize,
) -> <&MapArray as ArrayAccessor>::Item
unsafe fn value_unchecked( &self, index: usize, ) -> <&MapArray as ArrayAccessor>::Item
i
Read more§impl Array for MapArray
impl Array for MapArray
§fn slice(&self, offset: usize, length: usize) -> Arc<dyn Array>
fn slice(&self, offset: usize, length: usize) -> Arc<dyn Array>
§fn shrink_to_fit(&mut self)
fn shrink_to_fit(&mut self)
§fn offset(&self) -> usize
fn offset(&self) -> usize
0
. Read more§fn nulls(&self) -> Option<&NullBuffer>
fn nulls(&self) -> Option<&NullBuffer>
§fn logical_null_count(&self) -> usize
fn logical_null_count(&self) -> usize
§fn get_buffer_memory_size(&self) -> usize
fn get_buffer_memory_size(&self) -> usize
§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.§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 more§fn null_count(&self) -> usize
fn null_count(&self) -> usize
§fn is_nullable(&self) -> bool
fn is_nullable(&self) -> bool
false
if the array is guaranteed to not contain any logical nulls Read more§impl From<MapArray> for GenericListArray<i32>
impl From<MapArray> for GenericListArray<i32>
§fn from(value: MapArray) -> GenericListArray<i32>
fn from(value: MapArray) -> GenericListArray<i32>
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> 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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request