You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@arrow.apache.org by John Peterson <do...@gmail.com> on 2021/01/02 06:02:10 UTC
[Java] Map as key or value in Map (nested maps)
Hi All,
I’m attempting to convert the following data structure into vectors for
Arrow:
Map<String, Map<String, Integer>>
Using the UnionMapWriter, it seems that I can’t grab a map writer for the
value of the map, but a nested complex type such as a list is supported:
writer.value().list(); // works, get a ListWriter
writer.value().map(); // doesn’t work, no such method
Is this a known limitation, or is there a proper way to translate nested
map structures to Arrow? I’m planning on supporting a Map as both a key and
a value of a map. If there is a way to do this (even without the writers),
could you please point me to an example?
Thanks in advance for your help with this.
John
Re: [Java] Map as key or value in Map (nested maps)
Posted by Jacques Nadeau <ja...@apache.org>.
Agreed, oversight in the api.
On Mon, Jan 4, 2021 at 11:42 AM Micah Kornfield <em...@gmail.com>
wrote:
> Hi John,
> I believe this is an oversight in the API. I think we should probably
> open up a JIRA and try to address it.
>
> Depending on the use-case you might be able to write a map as
> list-of-struct<key, value> and replace the metadata at some point, but I'm
> not sure if this is possible in the Java library, so I don't have any
> examples.
>
> Thanks,
> Micah
>
> On Fri, Jan 1, 2021 at 10:02 PM John Peterson <
> donttrytocontactme2@gmail.com> wrote:
>
>> Hi All,
>>
>> I’m attempting to convert the following data structure into vectors for
>> Arrow:
>>
>> Map<String, Map<String, Integer>>
>>
>> Using the UnionMapWriter, it seems that I can’t grab a map writer for the
>> value of the map, but a nested complex type such as a list is supported:
>>
>> writer.value().list(); // works, get a ListWriter
>> writer.value().map(); // doesn’t work, no such method
>>
>> Is this a known limitation, or is there a proper way to translate nested
>> map structures to Arrow? I’m planning on supporting a Map as both a key and
>> a value of a map. If there is a way to do this (even without the writers),
>> could you please point me to an example?
>>
>> Thanks in advance for your help with this.
>>
>> John
>>
>
Re: [Java] Map as key or value in Map (nested maps)
Posted by Micah Kornfield <em...@gmail.com>.
Hi John,
I believe this is an oversight in the API. I think we should probably open
up a JIRA and try to address it.
Depending on the use-case you might be able to write a map as
list-of-struct<key, value> and replace the metadata at some point, but I'm
not sure if this is possible in the Java library, so I don't have any
examples.
Thanks,
Micah
On Fri, Jan 1, 2021 at 10:02 PM John Peterson <do...@gmail.com>
wrote:
> Hi All,
>
> I’m attempting to convert the following data structure into vectors for
> Arrow:
>
> Map<String, Map<String, Integer>>
>
> Using the UnionMapWriter, it seems that I can’t grab a map writer for the
> value of the map, but a nested complex type such as a list is supported:
>
> writer.value().list(); // works, get a ListWriter
> writer.value().map(); // doesn’t work, no such method
>
> Is this a known limitation, or is there a proper way to translate nested
> map structures to Arrow? I’m planning on supporting a Map as both a key and
> a value of a map. If there is a way to do this (even without the writers),
> could you please point me to an example?
>
> Thanks in advance for your help with this.
>
> John
>