Repository navigation
Fix regression: accept 0-byte offsets buffer for empty Arrow String/Binary columns - #107764
Merged
Algunenano merged 1 commit intoJun 22, 2026
Merged
Conversation
…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: ClickHouse#107749 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Contributor
|
Workflow [PR], commit [b17ae96] Summary: ❌
AI ReviewSummaryThis PR fixes the Missing context / blind spots
Final VerdictStatus: ✅ Approve |
Contributor
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 7/9 (77.78%) | Lost baseline coverage: none · Uncovered code |
Avogar
approved these changes
Jun 22, 2026
Merged
via the queue into
ClickHouse:master
with commit Jun 22, 2026
dc8e5e5
320 of 326 checks passed
robot-ch-test-poll4
added a commit
that referenced
this pull request
Jun 22, 2026
Cherry pick #107764 to 25.8: Fix regression: accept 0-byte offsets buffer for empty Arrow String/Binary columns
robot-clickhouse
added a commit
that referenced
this pull request
Jun 22, 2026
…r for empty Arrow String/Binary columns
robot-ch-test-poll4
added a commit
that referenced
this pull request
Jun 22, 2026
Cherry pick #107764 to 26.3: Fix regression: accept 0-byte offsets buffer for empty Arrow String/Binary columns
robot-clickhouse
added a commit
that referenced
this pull request
Jun 22, 2026
…r for empty Arrow String/Binary columns
robot-ch-test-poll4
added a commit
that referenced
this pull request
Jun 22, 2026
Cherry pick #107764 to 26.4: Fix regression: accept 0-byte offsets buffer for empty Arrow String/Binary columns
robot-clickhouse
added a commit
that referenced
this pull request
Jun 22, 2026
…r for empty Arrow String/Binary columns
robot-ch-test-poll4
added a commit
that referenced
this pull request
Jun 22, 2026
Cherry pick #107764 to 26.5: Fix regression: accept 0-byte offsets buffer for empty Arrow String/Binary columns
robot-clickhouse
added a commit
that referenced
this pull request
Jun 22, 2026
…r for empty Arrow String/Binary columns
fm4v
added a commit
that referenced
this pull request
Jun 23, 2026
Backport #107764 to 26.4: Fix regression: accept 0-byte offsets buffer for empty Arrow String/Binary columns
Algunenano
added a commit
that referenced
this pull request
Jun 23, 2026
Backport #107764 to 26.5: Fix regression: accept 0-byte offsets buffer for empty Arrow String/Binary columns
Algunenano
added a commit
that referenced
this pull request
Jun 23, 2026
Backport #107764 to 26.3: Fix regression: accept 0-byte offsets buffer for empty Arrow String/Binary columns
Algunenano
added a commit
that referenced
this pull request
Jun 23, 2026
Backport #107764 to 25.8: Fix regression: accept 0-byte offsets buffer for empty Arrow String/Binary columns
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Caused by: #106395
Closes: #107749
checkBinaryOffsetsBuffer(introduced in #106395) always required atleast
sizeof(offset_type)bytes even whenchunk.length() == 0.Apache Arrow Java < 19.0.0, as bundled with Apache Spark, emits a 0-byte
offsets buffer for empty
String/Binarychildren (e.g. when every maprow is empty, so the key child has zero elements). Every other Arrow
implementation (arrow-cpp, pyarrow, arrow-rs, Arrow Java >= 19.0.0)
accepts this; the non-compliance was fixed in apache/arrow-java#989, but
Spark users cannot control which Arrow Java version Spark bundles.
When
chunk.length() == 0, every caller's iteration loop is skipped andno byte of the offsets buffer is accessed, so requiring any bytes was a
spec-pedantry regression with no security benefit. The
checkValidityBitmapcall remains unconditional and continues to validate the null bitmap.
Fix: gate the
+1sentinel onchunk.length() > 0; when the column isempty, set
count_plus_one = 0so any buffer size (including 0 bytes)passes.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Reading Arrow/ArrowStream data with empty
String/Binarycolumns produced by Apache Arrow Java < 19.0.0 (including Apache Spark) no longer throwsINCORRECT_DATA.Version info
26.6.1.112326.5.4.4,26.4.5.61,26.3.15.3,25.8.25.31