pub struct DictionaryArray<K: DictionaryKey> { /* private fields */ }
Expand description

An Array whose values are stored as indices. This Array is useful when the cardinality of values is low compared to the length of the Array.

Safety

This struct guarantees that each item of DictionaryArray::keys is castable to usize and its value is smaller than DictionaryArray::values.len(). In other words, you can safely use unchecked calls to retrive the values

Implementations§

Returns a new DictionaryArray.

Implementation

This function is O(N) where N is the length of keys

Errors

This function errors iff

  • the data_type’s logical type is not a DictionaryArray
  • the data_type’s keys is not compatible with keys
  • the data_type’s values’s data_type is not equal with values.data_type()
  • any of the keys’s values is not represented in usize or is >= values.len()

Returns a new DictionaryArray.

Implementation

This function is O(N) where N is the length of keys

Errors

This function errors iff

  • any of the keys’s values is not represented in usize or is >= values.len()

Returns a new DictionaryArray.

Errors

This function errors iff

  • the data_type’s logical type is not a DictionaryArray
  • the data_type’s keys is not compatible with keys
  • the data_type’s values’s data_type is not equal with values.data_type()
Safety

The caller must ensure that every keys’s values is represented in usize and is < values.len()

Returns a new empty DictionaryArray.

Returns an DictionaryArray whose all elements are null

Returns an iterator of Option<Box<dyn Scalar>>.

Implementation

This function will allocate a new Scalar per item and is usually not performant. Consider calling keys_iter and values, downcasting values, and iterating over that.

Returns an iterator of Box<dyn Scalar>

Implementation

This function will allocate a new Scalar per item and is usually not performant. Consider calling keys_iter and values, downcasting values, and iterating over that.

Returns an iterator over the the values [V::IterValue].

Panics

Panics if the keys of this DictionaryArray have any null types. If they do DictionaryArray::iter_typed should be called

Returns an iterator over the the optional values of Option<V::IterValue>.

Panics

This function panics if the values array

Returns the DataType of this DictionaryArray

Returns whether the values of this DictionaryArray are ordered

Creates a new DictionaryArray by slicing the existing DictionaryArray.

Panics

iff offset + length > self.len().

Creates a new DictionaryArray by slicing the existing DictionaryArray.

Safety

Safe iff offset + length <= self.len().

Returns this DictionaryArray with a new validity.

Panic

This function panics iff validity.len() != self.len().

Sets the validity of the keys of this DictionaryArray.

Panics

This function panics iff validity.len() != self.len().

Returns the length of this array

The optional validity. Equivalent to self.keys().validity().

Returns the keys of the DictionaryArray. These keys can be used to fetch values from values.

Returns an iterator of the keys’ values of the DictionaryArray as usize

Returns an iterator of the keys’ of the DictionaryArray as usize

Returns the keys’ value of the DictionaryArray as usize

Panics

This function panics iff index >= self.len()

Returns the values of the DictionaryArray.

Returns the value of the DictionaryArray at position i.

Implementation

This function will allocate a new Scalar and is usually not performant. Consider calling keys and values, downcasting values, and iterating over that.

Panic

This function panics iff index >= self.len()

Boxes self into a Box<dyn Array>.

Boxes self into a std::sync::Arc<dyn Array>.

Trait Implementations§

Converts itself to a reference of Any, which enables downcasting to concrete types.
Converts itself to a mutable reference of Any, which enables mutable downcasting to concrete types.
The length of the Array. Every array has a length corresponding to the number of elements (slots).
The DataType of the Array. In combination with Array::as_any, this can be used to downcast trait objects (dyn Array) to concrete arrays.
The validity of the Array: every array has an optional Bitmap that, when available specifies whether the array slot is valid or not (null). When the validity is None, all slots are valid.
Slices the Array, returning a new Box<dyn Array>. Read more
Slices the Array, returning a new Box<dyn Array>. Read more
Clones this Array with a new new assigned bitmap. Read more
Clone a &dyn Array to an owned Box<dyn Array>.
whether the array is empty
The number of null slots on this Array. Read more
Returns whether slot i is null. Read more
Returns whether slot i is valid. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.