apache / apache/arrow-java

[Java] offset buffer for vector of variable-width type with zero value count is empty

Open
#273 3 comments 0 reactions 0 assignees View on GitHub
Type: bug
Dominant language
Java
Stars
94
Forks
152
Avg merge
3d 16h
Merged PRs (30d)
11

Description

I am reporting what I think might be two related bugs in `org.apache.arrow.vector.BaseVariableWidthVector`
1. The offset buffer is initialized as empty. I expect that it to have 4 bytes that represent the integer zero.
1. The `getBufferSize` method returns 0 when value count is zero, instead of 4.

Compare to the pyarrow implementation, which I believe correctly populates the offset buffer:
```java

>>> import pyarrow as pa
>>> array = pa.array([], type=pa.binary())
>>> array
[]
>>> print([b.hex().decode() for b in array.buffers()])
['', '00000000', '']

```
 

**Reporter**: [Steve M. Kim](https://issues.apache.org/jira/browse/ARROW-7342)

**Note**: *This issue was originally created as [ARROW-7342](https://issues.apache.org/jira/browse/ARROW-7342). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*

Contributor guide

Open the contributing guide

Research direction

Start with org.apache.arrow.vector.BaseVariableWidthVector, focusing on offset-buffer initialization and getBufferSize when the value count is zero. Compare the Java behavior with the empty pyarrow binary array shown in the report; done means the zero-value case exposes the expected four-byte zero offset and reports the corresponding buffer size.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
data-engineering
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.