Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
Description
Currently it's not that clear how to acces DictionaryArray keys and values using random indices.
The `DictionaryArray::keys` method exposes an Iterator with an `nth` method, but this requires a mut reference and feels a little bit out of place compared to other methods of accessing arrow data.
Another alternative seems to be to use the `From<ArrayDataRef> for PrimitiveArray<T>` conversion like so `let keys : Int16Array = dictionary_array.data().into()`. This seems to work fine but is not easily discoverable and also needs to be done outside of any loops for performance reasons.
I'd like methods on `DictionaryArray` to directly get the key at some index
```
pub fn key(&self, i: usize) -> &K
```
Ideally I'd also like an easier way to directly access values at some index, at least when those are primitive or string types.
```
pub fn value(&self, i: usize) -> &T
```
I'm not sure how or if that would be possible to implement with rust generics.
Attachments
Issue Links
- links to