pub struct Map { /* private fields */ }
Expand description
Map is a collection of key-value pairs with a key type and a value type. It used in Literal::Map, to make it hashable, the order of key-value pairs is stored in a separate vector so that we can hash the map in a deterministic way. But it also means that the order of key-value pairs is matter for the hash value.
When converting to Arrow (e.g., for Iceberg), the map should be represented using the default field name “key_value”.
Example:
let key_value_field = Field::new(
DEFAULT_MAP_FIELD_NAME,
arrow_schema::DataType::Struct(vec![
Arc::new(key_field.clone()),
Arc::new(value_field.clone()),
].into()),
false
);
'''
Implementations§
Source§impl Map
impl Map
Sourcepub fn insert(
&mut self,
key: Literal,
value: Option<Literal>,
) -> Option<Option<Literal>>
pub fn insert( &mut self, key: Literal, value: Option<Literal>, ) -> Option<Option<Literal>>
Inserts a key-value pair into the map. If the map did not have this key present, None is returned. If the map did have this key present, the value is updated, and the old value is returned.
Sourcepub fn get(&self, key: &Literal) -> Option<&Option<Literal>>
pub fn get(&self, key: &Literal) -> Option<&Option<Literal>>
Returns a reference to the value corresponding to the key. If the key is not present in the map, None is returned.
Sourcepub fn has_same_content(&self, other: &Map) -> bool
pub fn has_same_content(&self, other: &Map) -> bool
The order of map is matter, so this method used to compare two maps has same key-value pairs without considering the order.
Trait Implementations§
Source§impl IntoIterator for Map
impl IntoIterator for Map
impl Eq for Map
impl StructuralPartialEq for Map
Auto Trait Implementations§
impl Freeze for Map
impl RefUnwindSafe for Map
impl Send for Map
impl Sync for Map
impl Unpin for Map
impl UnwindSafe for Map
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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 more