Repository navigation
fix(arrow-ipc): compute variadic buffer counts from the unsliced run array - #12268
Open
Mola-maker wants to merge 1 commit into
Open
Mola-maker wants to merge 1 commit into
Mola-maker wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Rationale for this change
An IPC stream containing a
RunEndEncodedarray withUtf8View(orBinaryView) values sliced to zero rows does not read back. Inencode_record_batch_data, the buffers and the variadic buffer counts came from two different arrays:write_array_datawrites the children ofunslice_run_array(array_data), butappend_variadic_buffer_countswalked the originalarray_data. For a zero-row slice,into_zero_offset_run_arrayreturns an empty array whose Utf8View values own no data buffers (0 written), while the original values still own one (count 1). The reader then fails withIpcError("Invalid variadic count 1 for Utf8View column, with 2 buffer(s) left in the message"). The same happens when the view array is nested inside the run values, e.g.RunEndEncoded<Int32, ListView<Utf8View>>.What changes are included in this PR?
encode_record_batch_data, RunEndEncoded columns are unsliced before the variadic counts are computed, so the counts come from the same unsliced array the writer wrote.append_variadic_buffer_countsitself is unchanged.arrow-ipc/src/reader.rs: the issue reproducer exactly (Utf8View values with a non-inlined string, batch sliced to 0 rows), plus the nestedListView<Utf8View>andList<Utf8View>variants from the issue.Are these changes tested?
Yes. All three new tests fail on current main with the exact error from the issue and pass with the fix. The full


arrow-ipcsuite (169 tests) and the downstreamarrow-arrayandarrow-datasuites (1068 tests) pass, andcargo fmtandcargo clippyare clean.Are there any significant user-facing changes?
Behavior fix only: zero-row slices of RunEndEncoded arrays with view values now round-trip correctly. No public API change.
AI usage disclosure
AI assistance was used to implement the fix and tests, following the approach described in #12249; the changes were verified with the crate's test suite, clippy and fmt.