alamb opened a new issue #1158:
URL: https://github.com/apache/arrow-rs/issues/1158


   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   Right now it is quite cumbersome to create  a `MapArray` as one has to 
create  an `ArrayData` from a `StructArray` . `MapArray` was contributed by 
@nevi-me  in https://github.com/apache/arrow-rs/pull/491
   
   
https://github.com/apache/arrow-rs/blob/e898de57e4587c64387939f8a557bc5fa2dffeb8/arrow/src/array/array_map.rs#L243-L282
   
   
   **Describe the solution you'd like**
   
   It would be great to be able to create a `MapArray` directly from the 
appropriate `StructArray`. Something like this perhaps (though other proposals 
more than welcome):
   
   ```rust
   let entry_array = StructArray::from(vec![
               (keys, make_array(keys_data)),
               (values, make_array(values_data)),
           ]); 
   
   let map_array = MapArray::from(&entry_array).unwrap();
   ```
   
   Where `entry_array` would need to have two fields where the first was 
strings 
   
   The impl might look like
   
   ```
   impl From<&StructArray> for MapArray {
   ...
   }
   ```
   
   **Describe alternatives you've considered**
   A clear and concise description of any alternative solutions or features 
you've considered.
   
   **Additional context**
   https://github.com/apache/arrow-rs/pull/1149#discussion_r782433887
   
   


-- 
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