Function arrow_array::cast::as_dictionary_array
source · pub fn as_dictionary_array<T>(arr: &dyn Array) -> &DictionaryArray<T>where
T: ArrowDictionaryKeyType,
Expand description
Force downcast of an Array
, such as an ArrayRef
to
DictionaryArray<T>
, panic’ing on failure.
Example
let arr: DictionaryArray<Int32Type> = vec![Some("foo")].into_iter().collect();
let arr: ArrayRef = std::sync::Arc::new(arr);
let dict_array: &DictionaryArray<Int32Type> = as_dictionary_array::<Int32Type>(&arr);