You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "0xderek (via GitHub)" <gi...@apache.org> on 2024/10/09 14:03:47 UTC

[I] [Java] Does arrow allow map as map value (nested map) ? [arrow]

0xderek opened a new issue, #44353:
URL: https://github.com/apache/arrow/issues/44353

   ### Describe the usage question you have. Please include as many useful details as  possible.
   
   
   I'm trying to build a MapVector with map as its value, for example Map<Int, Map<Int, Int>>, but the code throws exception when writing data into the inner map.
   
   ```java
       @Test
       void testMapOfMap() {
           MapVector vector = new MapVector("map", allocator,
                   FieldType.nullable(new ArrowType.Map(false)), null);
           MapWriter writer = vector.getWriter();
   
           writer.startMap();
           writer.startEntry();
   
           writer.key().integer().writeInt(1);
   
           MapWriter innerMapWriter = writer.value().map();
           innerMapWriter.startMap();                         // <- throws at this line
           innerMapWriter.startEntry();
           innerMapWriter.key().integer().writeInt(1);
           innerMapWriter.value().integer().writeInt(2);
           innerMapWriter.endEntry();
           innerMapWriter.endMap();
   
           writer.endEntry();
           writer.endMap();
   
           vector.setValueCount(1);
           log.info(vector.toString());
       }
   ```
   
   Does Arrow support this? Or am I using this wrong?
   
   BTW I'm using JDK 8 and Arrow 17.0.0.
   
   Thanks
   
   ### Component(s)
   
   Java


-- 
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: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Java] Exceptions when building MapVector with map values [arrow]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm closed issue #44353: [Java] Exceptions when building MapVector with map values
URL: https://github.com/apache/arrow/issues/44353


-- 
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: issues-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Java] Exceptions when building MapVector with map values [arrow]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #44353:
URL: https://github.com/apache/arrow/issues/44353#issuecomment-2412594862

   Issue resolved by pull request 44390
   https://github.com/apache/arrow/pull/44390


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Java] Exceptions when building MapVector with map values [arrow]

Posted by "0xderek (via GitHub)" <gi...@apache.org>.
0xderek commented on issue #44353:
URL: https://github.com/apache/arrow/issues/44353#issuecomment-2408505089

   Some updates:
   
   The demo code works after changing `.map()` calls to `.map(boolean keySorted)`. 
   
   It turns out `UnionMapWriter` doesn't override `map()` and falls back to implementation in `UnionListWriter`. I think this is a bug.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org