MCPcopy Create free account
hub / github.com/apache/arrow-rs / downcast_dict

Method downcast_dict

arrow-array/src/array/dictionary_array.rs:432–438  ·  view source on GitHub ↗

Downcast this dictionary to a [`TypedDictionaryArray`] ``` use arrow_array::{Array, ArrayAccessor, DictionaryArray, StringArray, types::Int32Type}; let orig = [Some("a"), Some("b"), None]; let dictionary = DictionaryArray:: ::from_iter(orig); let typed = dictionary.downcast_dict:: ().unwrap(); assert_eq!(typed.value(0), "a"); assert_eq!(typed.value(1), "b"); assert!(typed.i

(&self)

Source from the content-addressed store, hash-verified

430 /// ```
431 ///
432 pub fn downcast_dict<V: 'static>(&self) -> Option<TypedDictionaryArray<'_, K, V>> {
433 let values = self.values.as_any().downcast_ref()?;
434 Some(TypedDictionaryArray {
435 dictionary: self,
436 values,
437 })
438 }
439
440 /// Returns a new dictionary with the same keys as the current instance
441 /// but with a different set of dictionary values

Calls 1

as_anyMethod · 0.45