[Java] MapVector written data does not meet expectations
- 主要語言
- Java
- 星號
- 94
- 分支
- 152
- 平均合併
- 3 天 16 小時
- 30 天內合併 PR
- 11
描述
### What would you like help with?
```
RootAllocator allocator = new RootAllocator(Long.MAX_VALUE);
Map 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](https://arrow.apache.org/docs/java/vector.html#building-listvector) are available in the documentation on the official website ,Please provide an example of writing data to MapVector.

貢獻指南
研究方向
使用 MapVector 和 UnionMapWriter 重現提供的 Java 程式碼片段,然後檢查 MapVector 和 UnionMapWriter 的寫入路徑,了解其對不同鍵型別和值型別的處理。比較現有的 ListVector 文件範例,並將完成定義為以下任一項:成功寫入具有混合型別的 MapVector,或提供一個有文件說明且可運作的 MapVector 範例,並由回歸測試支援。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- java
- 領域
- data
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100