You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RootAllocator allocator = new RootAllocator(Long.MAX_VALUE);
Map<String, String> metadata = new HashMap<>();
metadata.put("K1", "V1");
metadata.put("K2", "V2");
Field a = new Field("key", FieldType.notNullable(new ArrowType.Int(32, true)), null);
Field b = new Field("value", FieldType.nullable(new ArrowType.Int(32,true)), null);
Schema schema = new Schema(asList(a, b), metadata);
Field struct = new Field("struct", FieldType.notNullable(new ArrowType.Struct()), schema.getFields());
StructVector structVector = new StructVector(Field.nullable("struct", struct.getType()), allocator, null);
MapVector mapVector = new MapVector(Field.nullable("map", structVector.getField().getType()), allocator, null);
mapVector.initializeChildrenFromFields(Collections.singletonList(struct));
mapVector.allocateNew();
UnionMapWriter writer = mapVector.getWriter();
for (int i = 0; i < 10; i++) {
writer.startMap();
writer.setPosition(i);
writer.key().writeInt(i);
writer.value().writeInt(i * 10);
writer.endMap();
}
writer.setValueCount(10);
when the types of key and value are different, data cannot be written .
Only examples of ListVector are available in the documentation on the official website ,Please provide an example of writing data to MapVector.
The text was updated successfully, but these errors were encountered:
hawk9821
changed the title
[Java] MapVector write demo
[Java] MapVector written data does not meet expectations
Nov 6, 2024
What would you like help with?
when the types of key and value are different, data cannot be written .
Only examples of ListVector are available in the documentation on the official website ,Please provide an example of writing data to MapVector.
The text was updated successfully, but these errors were encountered: