HaoYang670 commented on code in PR #2297:
URL: https://github.com/apache/arrow-rs/pull/2297#discussion_r938582275


##########
arrow/src/array/array_dictionary.rs:
##########
@@ -385,6 +404,86 @@ impl<T: ArrowPrimitiveType> fmt::Debug for 
DictionaryArray<T> {
     }
 }
 
+/// A strongly-typed wrapper around a [`DictionaryArray`] that implements 
[`ArrayAccessor`]
+/// allowing fast access to its elements
+///
+/// ```
+/// use arrow::array::{ArrayIter, DictionaryArray, StringArray};
+/// use arrow::datatypes::Int32Type;
+///
+/// let orig = ["a", "b", "a", "b"];
+/// let dictionary = DictionaryArray::<Int32Type>::from_iter(orig);
+/// let typed = dictionary.downcast_dict::<StringArray>().unwrap();
+///
+/// for (maybe_val, orig) in typed.into_iter().zip(orig) {
+///     assert_eq!(maybe_val.unwrap(), orig)
+/// }
+/// ```
+#[derive(Copy, Clone)]
+pub struct TypedDictionaryArray<'a, K: ArrowPrimitiveType, V> {
+    /// The dictionary array
+    pub dictionary: &'a DictionaryArray<K>,

Review Comment:
   Sorry for the late.
   I prefer to name it `base`, but never mind, this is really a small tip.
   LGTM!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to