apache / apache/arrow-java

[Java] Should ListVector.reset() reset the position(index)?

Đang mở
#205 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Type: bug
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ả

```java
RootAllocator rootAllocator = new RootAllocator();
ListVector identity = ListVector.empty("identity", rootAllocator);
VectorSchemaRoot root = new VectorSchemaRoot(List.of(identity));
root.allocateNew();

UnionListWriter writer = identity.getWriter();

byte[] bytes1 = "hello1".getBytes(StandardCharsets.UTF_8);
ArrowBuf buffer = rootAllocator.buffer(bytes1.length);
buffer.setBytes(0,bytes1);
writer.startList();
writer.varChar().writeVarChar(0,bytes1.length,buffer);
writer.endList();
root.setRowCount(1);
System.out.println(root.contentToTSVString());

root.getFieldVectors().forEach(ValueVector::reset); //reset fieldVector

byte[] bytes2 = "hello2".getBytes(StandardCharsets.UTF_8);
buffer.setBytes(0,bytes2);
writer.startList();
writer.varChar().writeVarChar(0,bytes2.length,buffer);
writer.endList();

root.setRowCount(1);
System.out.println(root.contentToTSVString());
```

the result is
```
identity
["hello1"]

identity
null
```

The above results are confusing。

The correct way is using the `writer.setPosition(index)`,

I don't know if it's a bug or other something.

### Component(s)

Java

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

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

Hướng nghiên cứu

Bắt đầu bằng cách chạy reproduction Java sử dụng ListVector, ValueVector.reset() và UnionListWriter.setPosition(index) để quan sát hành vi của vị trí. Đọc các triển khai liên quan của reset và vị trí của writer, sau đó xác định kết quả mong đợi sau khi reset và thêm coverage cho sequence được minh họa để hành vi không còn mơ hồ.

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
45/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.