[][src]Struct arrow::array::DictionaryArray

pub struct DictionaryArray<K: ArrowPrimitiveType> { /* fields omitted */ }

A dictionary array where each element is a single value indexed by an integer key. This is mostly used to represent strings or a limited set of primitive types as integers, for example when doing NLP analysis or representing chromosomes by name.

Example with nullable data:

use arrow::array::DictionaryArray;
use arrow::datatypes::Int8Type;
let test = vec!["a", "a", "b", "c"];
let array : DictionaryArray<Int8Type> = test.iter().map(|&x| if x == "b" {None} else {Some(x)}).collect();
assert_eq!(array.keys().collect::<Vec<Option<i8>>>(), vec![Some(0), Some(0), None, Some(1)]);

Example without nullable data:

use arrow::array::DictionaryArray;
use arrow::datatypes::Int8Type;
let test = vec!["a", "a", "b", "c"];
let array : DictionaryArray<Int8Type> = test.into_iter().collect();
assert_eq!(array.keys().collect::<Vec<Option<i8>>>(), vec![Some(0), Some(0), Some(1), Some(2)]);

Implementations

impl<'a, K: ArrowPrimitiveType> DictionaryArray<K>[src]

pub fn keys(&self) -> NullableIter<'_, K::Native>[src]

Return an iterator to the keys of this dictionary.

pub fn keys_array(&self) -> PrimitiveArray<K>[src]

Returns an array view of the keys of this dictionary

pub fn lookup_key(&self, value: &str) -> Option<K::Native>[src]

Returns the lookup key by doing reverse dictionary lookup

pub fn values(&self) -> ArrayRef[src]

Returns an ArrayRef to the dictionary values.

pub fn value_type(&self) -> DataType[src]

Returns a clone of the value type of this list.

pub fn len(&self) -> usize[src]

The length of the dictionary is the length of the keys array.

pub fn is_empty(&self) -> bool[src]

Whether this dictionary is empty

pub fn is_ordered(&self) -> bool[src]

Trait Implementations

impl<T: ArrowPrimitiveType> Array for DictionaryArray<T>[src]

fn get_buffer_memory_size(&self) -> usize[src]

Returns the total number of bytes of memory occupied by the buffers owned by this DictionaryArray.

fn get_array_memory_size(&self) -> usize[src]

Returns the total number of bytes of memory occupied physically by this DictionaryArray.

impl<T: ArrowPrimitiveType> ArrayEqual for DictionaryArray<T>[src]

impl<T: ArrowPrimitiveType> Debug for DictionaryArray<T>[src]

impl<T: ArrowPrimitiveType> From<Arc<ArrayData>> for DictionaryArray<T>[src]

Constructs a DictionaryArray from an array data reference.

impl<'a, T: ArrowPrimitiveType + ArrowDictionaryKeyType> FromIterator<&'a str> for DictionaryArray<T>[src]

Constructs a DictionaryArray from an iterator of strings.

impl<'a, T: ArrowPrimitiveType + ArrowDictionaryKeyType> FromIterator<Option<&'a str>> for DictionaryArray<T>[src]

Constructs a DictionaryArray from an iterator of optional strings.

impl<T: ArrowPrimitiveType> JsonEqual for DictionaryArray<T>[src]

impl<T: ArrowPrimitiveType> PartialEq<DictionaryArray<T>> for Value[src]

impl<T: ArrowPrimitiveType> PartialEq<Value> for DictionaryArray<T>[src]

Auto Trait Implementations

impl<K> !RefUnwindSafe for DictionaryArray<K>

impl<K> Send for DictionaryArray<K>

impl<K> Sync for DictionaryArray<K>

impl<K> Unpin for DictionaryArray<K>

impl<K> !UnwindSafe for DictionaryArray<K>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,