davisusanibar commented on issue #39787:
URL: https://github.com/apache/arrow/issues/39787#issuecomment-1910881503
@gszadovszky Would it be possible to use MapVector instead?
````
import org.apache.arrow.memory.RootAllocator;
import org.apache.arrow.vector.complex.MapVector;
import org.apache.arrow.vector.complex.impl.UnionMapWriter;
public class TestMeMapVector {
public static void main(String[] args) {
try (MapVector mapVector = MapVector.empty("map", new
RootAllocator(), false)) {
mapVector.allocateNew();
UnionMapWriter mapWriter = mapVector.getWriter();
mapWriter.allocate();
mapWriter.startMap();
mapWriter.startEntry();
mapWriter.key().varChar().writeVarChar("one");
mapWriter.value().integer().writeInt(1);
mapWriter.endEntry();
mapWriter.startEntry();
mapWriter.key().varChar().writeVarChar("two");
mapWriter.value().integer().writeInt(2);
mapWriter.endEntry();
mapWriter.startEntry();
mapWriter.key().varChar().writeVarChar("three");
mapWriter.value().integer().writeInt(3);
mapWriter.endEntry();
mapWriter.writeNull();
mapWriter.startEntry();
mapWriter.key().varChar().writeVarChar("four");
mapWriter.value().integer().writeNull();
mapWriter.endEntry();
mapWriter.startEntry();
mapWriter.key().varChar().writeVarChar("five");
mapWriter.value().integer().writeInt(5);
mapWriter.endEntry();
mapWriter.endMap();
mapWriter.setValueCount(1);
System.out.println(mapVector);
//
[[{"key":"one","value":1},{"key":"two","value":2},{"key":"three","value":3},null,{"key":"four"},{"key":"five","value":5}]]
}
}
}
````
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]