[ 
https://issues.apache.org/jira/browse/ARROW-8383?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kouhei Sutou reassigned ARROW-8383:
-----------------------------------

    Assignee: Jörn Horstmann

> [Rust] Easier random access to DictionaryArray keys and values
> --------------------------------------------------------------
>
>                 Key: ARROW-8383
>                 URL: https://issues.apache.org/jira/browse/ARROW-8383
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Rust
>            Reporter: Jörn Horstmann
>            Assignee: Jörn Horstmann
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> 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.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to