Skip to content

Cherry pick #107764 to 26.5: Fix regression: accept 0-byte offsets buffer for empty Arrow String/Binary columns - #108161

Merged
robot-ch-test-poll4 merged 3 commits into
backport/26.5/107764from
cherrypick/26.5/107764
Jun 22, 2026
Merged

robot-ch-test-poll4 merged 3 commits into
backport/26.5/107764from
cherrypick/26.5/107764

Conversation

@robot-ch-test-poll4

Copy link
Copy Markdown
Contributor

Original pull-request #107764

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

Algunenano and others added 3 commits June 17, 2026 16:04
…columns

`checkBinaryOffsetsBuffer` always required at least `sizeof(offset_type)`
bytes (the `+1` sentinel entry), even when `chunk.length() == 0`.
Apache Arrow Java < 19.0.0, as bundled with Apache Spark, emits a 0-byte
offsets buffer for empty String/Binary children (e.g. when every map row
is empty so the key child has zero elements).  Every other Arrow
implementation (arrow-cpp, pyarrow, arrow-rs, Arrow Java >= 19) accepts
this; arrow-java fixed the non-compliance in apache/arrow-java#989.

When `chunk.length() == 0`, every caller's iteration loop is skipped and
no byte of the offsets buffer is ever accessed, so requiring any bytes was
a spec-pedantry regression, not a security necessity (confirmed by
thorough code review of all 8 call sites).  The `checkValidityBitmap`
call inside `checkBinaryOffsetsBuffer` is unconditional and continues to
validate the null bitmap.

Fix: gate the `+1` sentinel on `chunk.length() > 0`; when the column is
empty, set `count_plus_one = 0` so any buffer size (including 0 bytes)
passes the check.

Regression tests in `04356_arrow_empty_string_offsets.sh` cover:
standalone empty `String` column, `Map(String, Int32)` with all-empty
rows, and `Array(String)` with all-empty rows — all using the 0-byte
offsets buffer that Arrow Java < 19.0.0 produces.

Closes: #107749

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…sets

Fix regression: accept 0-byte offsets buffer for empty Arrow String/Binary columns
@robot-ch-test-poll4 robot-ch-test-poll4 added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default labels Jun 22, 2026
@robot-ch-test-poll4
robot-ch-test-poll4 merged commit 069a0c1 into backport/26.5/107764 Jun 22, 2026
@robot-ch-test-poll4
robot-ch-test-poll4 deleted the cherrypick/26.5/107764 branch June 22, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-bugfix Pull request with bugfix, not backported by default pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants