apache / apache/arrow-java

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

オープン
#205 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
Type: bug
主要言語
Java
スター
94
フォーク
152
平均マージ
3日 16時間
マージ済み PR(30日)
11

説明

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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、ListVector、ValueVector.reset()、UnionListWriter.setPosition(index) を使用して Java の再現を実行し、位置の挙動を観察します。次に、関係する reset と writer の位置指定の実装を読み、リセット後に期待される結果を明確にしたうえで、動作が曖昧にならないよう、示されたシーケンスのカバレッジを追加します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
data
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。