apache / apache/arrow-java

`UnionListReader.setPosition` throws IOOBE on a post-IPC empty List

Đang mở
#1,125 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ả

### Describe the bug, including details regarding any error messages, version, and platform.

On 19.0.0 (and on master), calling `setPosition` on a `ListVector` that came off the wire via IPC with `valueCount == 0` throws `IndexOutOfBoundsException`.

Some callers may hit this without touching `setPosition` themselves as
- `SingleStructReaderImpl.reader(String)` calls `setPosition(idx())` the first time a child reader on a struct is looked up.
- `UnionMapReader` inherits from `UnionListReader` and breaks the same way.
- `UnionLargeListReader` has a related variant; capacity guard seems to be missing and it fails whenever the offset buffer is shorter than `(idx + 2) * 8` bytes.

The reader code hasn't changed. `ListVector.setReaderAndWriterIndex` changes and now correctly emits the leading `[0]` offset when `valueCount == 0` (as per the Arrow spec), so the receiver's offset buffer is no longer "zero-capacity" and if block `capacity() == 0` never enters.

### Repro

The shape we actually hit — a struct with a list-typed child, struct itself having `valueCount == 0`:

```java
StructVector parent = ...; // child "l" is LIST, valueCount == 0
parent.getReader().reader("l"); // IOOBE
```

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

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

Hướng nghiên cứu

Bắt đầu với UnionListReader.setPosition và lần theo các lệnh gọi từ SingleStructReaderImpl.reader(String); so sánh các đường đi liên quan của UnionMapReader và UnionLargeListReader được mô tả trong issue. Tái hiện trường hợp danh sách rỗng sau IPC, sau đó xác minh rằng các reader này không còn ném IndexOutOfBoundsException khi các offset hoặc capacity rỗng hoặc ngắn hơn dự kiến.

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
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
67/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.