Struct arrow::array::DictionaryArray [−][src]
pub struct DictionaryArray<K: ArrowPrimitiveType> { /* fields omitted */ }
Expand description
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, Int8Array}; 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(), &Int8Array::from(vec![Some(0), Some(0), None, Some(1)]));
Example without nullable data:
use arrow::array::{DictionaryArray, Int8Array}; use arrow::datatypes::Int8Type; let test = vec!["a", "a", "b", "c"]; let array : DictionaryArray<Int8Type> = test.into_iter().collect(); assert_eq!(array.keys(), &Int8Array::from(vec![0, 0, 1, 2]));
Implementations
impl<'a, K: ArrowPrimitiveType> DictionaryArray<K>
[src]
impl<'a, K: ArrowPrimitiveType> DictionaryArray<K>
[src]pub fn keys(&self) -> &PrimitiveArray<K>
[src]
pub fn keys(&self) -> &PrimitiveArray<K>
[src]Return an iterator to the keys of this dictionary.
pub fn keys_array(&self) -> PrimitiveArray<K>
[src]
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]
pub fn lookup_key(&self, value: &str) -> Option<K::Native>
[src]Returns the lookup key by doing reverse dictionary lookup
pub fn value_type(&self) -> DataType
[src]
pub fn value_type(&self) -> DataType
[src]Returns a clone of the value type of this list.
pub fn is_ordered(&self) -> bool
[src]
Trait Implementations
impl<T: ArrowPrimitiveType> Array for DictionaryArray<T>
[src]
impl<T: ArrowPrimitiveType> Array for DictionaryArray<T>
[src]fn get_buffer_memory_size(&self) -> usize
[src]
fn get_buffer_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied by the buffers owned by this array.
fn get_array_memory_size(&self) -> usize
[src]
fn get_array_memory_size(&self) -> usize
[src]Returns the total number of bytes of memory occupied physically by this array.
fn data_ref(&self) -> &ArrayData
[src]
fn data_ref(&self) -> &ArrayData
[src]Returns a reference-counted pointer to the underlying data of this array.
fn slice(&self, offset: usize, length: usize) -> ArrayRef
[src]
fn slice(&self, offset: usize, length: usize) -> ArrayRef
[src]Returns a zero-copy slice of this array with the indicated offset and length. Read more
fn offset(&self) -> usize
[src]
fn offset(&self) -> usize
[src]Returns the offset into the underlying data used by this array(-slice).
Note that the underlying data can be shared by many arrays.
This defaults to 0
. Read more
fn is_null(&self, index: usize) -> bool
[src]
fn is_null(&self, index: usize) -> bool
[src]Returns whether the element at index
is null.
When using this function on a slice, the index is relative to the slice. Read more
fn is_valid(&self, index: usize) -> bool
[src]
fn is_valid(&self, index: usize) -> bool
[src]Returns whether the element at index
is not null.
When using this function on a slice, the index is relative to the slice. Read more
fn null_count(&self) -> usize
[src]
fn null_count(&self) -> usize
[src]Returns the total number of null values in this array. Read more
fn to_raw(&self) -> Result<(*const FFI_ArrowArray, *const FFI_ArrowSchema)>
[src]
fn to_raw(&self) -> Result<(*const FFI_ArrowArray, *const FFI_ArrowSchema)>
[src]returns two pointers that represent this array in the C Data Interface (FFI)
impl<T: ArrowPrimitiveType> Debug for DictionaryArray<T>
[src]
impl<T: ArrowPrimitiveType> Debug for DictionaryArray<T>
[src]impl<T: ArrowPrimitiveType> From<ArrayData> for DictionaryArray<T>
[src]
impl<T: ArrowPrimitiveType> From<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]
impl<'a, T: ArrowPrimitiveType + ArrowDictionaryKeyType> FromIterator<&'a str> for DictionaryArray<T>
[src]Constructs a DictionaryArray
from an iterator of strings.
fn from_iter<I: IntoIterator<Item = &'a str>>(iter: I) -> Self
[src]
fn from_iter<I: IntoIterator<Item = &'a str>>(iter: I) -> Self
[src]Creates a value from an iterator. Read more
impl<'a, T: ArrowPrimitiveType + ArrowDictionaryKeyType> FromIterator<Option<&'a str>> for DictionaryArray<T>
[src]
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> JsonEqual 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> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,