Not sure if I am using this wrong, but I noticed getNewFieldWriter for the minorType MAP is returning a UnionListWriter instead of a UnionMapWriter.
|
@Override |
|
public FieldWriter getNewFieldWriter(ValueVector vector) { |
|
return new UnionListWriter((MapVector) vector); |
|
} |
|
}, |
This leads to the issue of this code block throwing an error:
writer = 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:
@Override
public FieldWriter getNewFieldWriter(ValueVector vector) {
return new UnionMapWriter((MapVector) vector);
}