hawk9821 opened a new issue, #44664:
URL: https://github.com/apache/arrow/issues/44664

   ### What would you like help with?
   
   ```
       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 .  
Please provide an example of writing data to MapVector
   
   
![image](https://github.com/user-attachments/assets/9d081d9a-6f0d-48c9-a4fd-a4ddaa26450b)
   


-- 
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