apache / apache/arrow-java

[Java] ArrowRecordBatch Body Length Computation Only Accounts for Last Buffer

Open
#188 0 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

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

Hi Arrow Community,

I believe `ArrowRecordBatch::computeBodyLength` has an implementation bug. It does the following

```
for (int i = 0; i < buffers.size(); i++) {
ArrowBuf buffer = buffers.get(i);
ArrowBuffer layout = buffersLayout.get(i);
size = layout.getOffset() + buffer.readableBytes();

// round up size to the next multiple of 8
size = DataSizeRoundingUtil.roundUpTo8Multiple(size);
}
return size;
```

Since `size` is being assigned and not incremented at first - does this mean computeBodyLength only accounts for the last buffer ?

### Component(s)

Java

Contributor guide

Open the contributing guide

Research direction

Start at ArrowRecordBatch::computeBodyLength and inspect how buffer layouts and readable bytes contribute to the returned value. Reproduce the calculation with multiple buffers, then check the surrounding Java code or tests for the expected body-length semantics. Done means the computation accounts for every buffer and preserves the required 8-byte rounding.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
data-engineering
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.