apache / apache/arrow-java

[Java] MapVector written data does not meet expectations

Đang mở
#40 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
Component: Documentation
Ngôn ngữ chính
Java
Star
94
Fork
152
Merge trung bình
3 ngày 16 giờ
Pull request đã merge (30 ngày)
11

Mô tả

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

![image](https://github.com/user-attachments/assets/9d081d9a-6f0d-48c9-a4fd-a4ddaa26450b)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Tái hiện đoạn mã Java được cung cấp bằng MapVector và UnionMapWriter, sau đó kiểm tra đường dẫn ghi của MapVector và UnionMapWriter để xem cách xử lý các kiểu khóa và giá trị khác nhau. So sánh với ví dụ tài liệu ListVector hiện có và xác định việc hoàn thành là ghi MapVector với các kiểu hỗn hợp thành công hoặc một ví dụ MapVector hoạt động được và đã được tài liệu hóa, có kiểm thử hồi quy hỗ trợ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
data
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.