wsuppiger opened a new issue, #625:
URL: https://github.com/apache/arrow-java/issues/625

   Not sure if I am using this wrong, but I noticed `getNewFieldWriter` for the 
minorType `MAP` is returning a `UnionListWriter` instead of a `UnionMapWriter`.
   
   
https://github.com/apache/arrow-java/blob/799d9fd45e36d962c7a7bae0f3903bb414062554/vector/src/main/java/org/apache/arrow/vector/types/Types.java#L722-L726
   
   This leads to the issue of this code block throwing an error:
   ```java
   MinorType.MAP.getNewFieldWriter(myMapVector)
   writer.startMap()
   ```
   Exception:
   ```
   You tried to start a map key when you are using a ValueWriter of type 
UnionListWriter.
   java.lang.IllegalStateException: You tried to start a map key when you are 
using a ValueWriter of type UnionListWriter.
        at 
org.apache.arrow.vector.complex.impl.AbstractFieldWriter.key(AbstractFieldWriter.java:123)
        at 
org.apache.arrow.vector.complex.impl.UnionListWriter.key(UnionListWriter.java:69)
   ...
   ```
   
   I believe this code can be easily fixed by just changing it to:
   ```java
      @Override 
      public FieldWriter getNewFieldWriter(ValueVector vector) { 
        return new UnionMapWriter((MapVector) vector); 
      } 
   ```


-- 
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-unsubscr...@arrow.apache.org.apache.org

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

Reply via email to