[ 
https://issues.apache.org/jira/browse/ARROW-15089?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17475134#comment-17475134
 ] 

Weston Pace commented on ARROW-15089:
-------------------------------------

To solve the "maps don't have unique keys" problem I think this kernel should 
take an integer index instead of a string key.  We generally assume plan 
construction happens when the schema is fully known so the plan constructor 
should be able to figure out the correct index based on whether they want 
"first matching" or "last matching".

For nested structs (e.g. { "location": { "x": 0, "y": 3 }, "magnitude": 7.3 }) 
it seems the easiest thing to do would be to require two function calls.  So to 
get the field {{"y"}} in that example you would do something like 
{{extract_field(extract_field(arr, 0), 1)}}.  I suppose it would be possible to 
treat the indices as DFS indices (e.g. {{"x"=0, "y"=1, "magnitude"=2}} ) but 
that gets rather confusing rather quickly.

> [C++] Add compute kernel to get MapArray value for given key
> ------------------------------------------------------------
>
>                 Key: ARROW-15089
>                 URL: https://issues.apache.org/jira/browse/ARROW-15089
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C++
>    Affects Versions: 6.0.1
>            Reporter: Will Jones
>            Assignee: Dhruv Vats
>            Priority: Major
>              Labels: C++, Kernels, beginner, compute, good-second-issue, 
> kernel
>
> Given a "map", an obvious operation is to get an item corresponding to a key. 
> The idea here is to create a kernel that does this for each map in the array.
> IIRC MapArray isn't guaranteed to have unique keys. So one version would 
> return an array of ItemType by returning the first of last item for a given 
> key. Yet another version could return a ListType containing all matching 
> items. 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to