apache / apache/arrow-java

DenseUnionVector is not transferred correctly

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

説明

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

Hello,

I encountered a weird issue when converting a `Table` to a `VectorSchemaRoot`. All the `DenseUnionVector` were empty after the conversion.
From my understanding, it looks like there is a bug in the `TransferImpl.transfer` method of the `DenseUnionVector`.
After copying the `valueCount` value to the second vector [in this line](https://github.com/apache/arrow/blob/45918a90a6ca1cf3fd67c256a7d6a240249e555a/java/vector/src/main/codegen/templates/DenseUnionVector.java#L634), it should also set the `nextTypeId`.
After the transfer, `nextTypeId` is equals to `0`, so trying to transfer again would create an empty vector as [the for loop is done against the `nextTypeId`](https://github.com/apache/arrow/blob/45918a90a6ca1cf3fd67c256a7d6a240249e555a/java/vector/src/main/codegen/templates/DenseUnionVector.java#L628)

Proposed fix would be as simple as :

```java
@Override
public void transfer() {

...

for (int i = 0; i < nextTypeId; i++) {
if (internalTransferPairs[i] != null) {
internalTransferPairs[i].transfer();
to.childVectors[i] = internalTransferPairs[i].getTo();
}
}
to.valueCount = valueCount;
to.nextTypeId = nextTypeId;
clear();
}
```

I will raise a PR with the change.

### Component(s)

Java

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

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

調査の方向性

java/vector/src/main/codegen/templates/DenseUnionVector.java から始め、特に TransferImpl.transfer と nextTypeId を使用するループを確認してください。Table から VectorSchemaRoot への変換を再現し、転送された DenseUnionVector が値の数と型の状態を保持していることを検証して、その後の転送が空にならないようにしてください。

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

評価

技術スタック
java
領域
data
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
50/100

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

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