sap1ens opened a new issue, #833:
URL: https://github.com/apache/arrow-java/issues/833
### Describe the bug, including details regarding any error messages,
version, and platform.
`BaseVariableWidthVector`-based vectors (`VarBinaryVector`, `VarCharVector`)
expect the data to be written sequentially. This means `Consumer.setPosition`
is not safe to use. Imagine the following scenario:
- write index 0
- write index 2
- write index 1
- write index 3
On the last step, `BaseVariableWidthVector.fillHoles` erases the data
written for the index 2:
```java
protected final void fillHoles(int index) {
for (int i = lastSet + 1; i < index; i++) {
setBytes(i, emptyByteArray, 0, emptyByteArray.length);
}
lastSet = index - 1;
}
```
Here, index would be 3, lastSet + 1 would be 2 (1 + 1), so `setBytes(2,
emptyByteArray, ...)` is called.
Not sure what the right solution is here, but at a minimum, the library
shouldn't allow calling `setPosition` for Consumers using
`BaseVariableWidthVector` vectors.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]