prouhard opened a new issue, #200: URL: https://github.com/apache/arrow-java/issues/200
### 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 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@arrow.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org