apache / apache/arrow-java

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

未關閉
#1,125 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
Type: bug
主要語言
Java
星號
94
分支
152
平均合併
3 天 16 小時
30 天內合併 PR
11

描述

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

貢獻指南

開啟貢獻指南

研究方向

從 UnionListReader.setPosition 開始,追蹤從 SingleStructReaderImpl.reader(String) 發出的呼叫;比較 issue 中描述的相關 UnionMapReader 和 UnionLargeListReader 路徑。重現 IPC 後列表為空的情況,然後驗證當 offsets 或 capacity 為空或短於預期時,這些 reader 不再拋出 IndexOutOfBoundsException。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
java
領域
data
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
冷清
描述清晰度
基本清楚
新手友好度
67/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。