Skip to content

[58_maintenance] fix(arrow-array): avoid returning corrupt array in GenericByteArray::into_builder - #11707

Merged
Jefffrey merged 2 commits into
apache:58_maintenancefrom
Jefffrey:backport_11311_58
Oct 22, 2026
Merged

Jefffrey merged 2 commits into
apache:58_maintenancefrom
Jefffrey:backport_11311_58

Conversation

@Jefffrey

Copy link
Copy Markdown
Contributor

@Jefffrey

Copy link
Copy Markdown
Contributor Author

@github-actions github-actions Bot added the arrow-core Core crates related to representing arrow data label Oct 19, 2026
Jefffrey added a commit that referenced this pull request Oct 21, 2026
…oc, MIRI and integration test fixes (#11727)

# Which issue does this PR close?

- Part of #11665 (58.4.1 release)

# Rationale for this change

CI on the 58_maintenance branch is red on every PR (e.g. #11365, #11703,
#11704, #11705, #11707) for reasons unrelated to those PRs.



# What changes are included in this PR?

- Check in the root `Cargo.lock`, the same approach as
#9941
- Backport #11305: remove duplicate `homepage` entries and let rustdoc
infer the targets of five `arrow-avro` intra-doc links.
- Backport #10433: stop asserting on the unstable `TryFromIntError`
message in the `arrow-schema` tests.
- Backport #9888: support `ListView`, `BinaryView` and `RunEndEncoded`
in the integration test JSON parser.

# Are these changes tested?

Yes by CI

# Are there any user-facing changes?

No.

---------

Signed-off-by: Jiawei Zhao <Phoenix500526@163.com>
Co-authored-by: Aditya Mishra <bit2swaz@gmail.com>
Co-authored-by: Dewey Dunnington <dewey@wherobots.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Jeffrey Vo <jeffrey.vo.australia@gmail.com>
Co-authored-by: Phoenix <Phoenix500526@163.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…:into_builder` (apache#11311)

# Which issue does this PR close?

- N/A

# Rationale for this change

`GenericByteArray::into_builder` attempts to convert the byte array into
a builder without copying the underlying buffers, returning an error if
that cannot be done. When it was called with a sliced array whose first
offset was non-zero, it returned a corrupted array whose offsets pointed
past the underlying values array.

To fix this, refactor `into_builder` so that it avoids modifying the
values array until we are sure that `into_builder` will succeed.

Along the way, we arrange to copy the input null buffer if it can't be
reused; the null buffer is small, so it doesn't seem worth forcing the
caller to copy the rest of the array fields if the array could otherwise
be reused.

# What changes are included in this PR?

* Refactor `GenericByteArray::into_builder` and fix bug, as described
above
* Add unit tests
* Adjust `GenericByteBuilder::new_from_buffer` to truncate any bytes in
the buffer beyond the last offset


# Are these changes tested?

Yes; existing tests pass, new unit tests added.

# Are there any user-facing changes?

No.
@alamb
alamb force-pushed the backport_11311_58 branch from b310bcc to f1c2fa9 Compare October 21, 2026 20:01
@alamb

alamb commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

I rebased this now that #11706 is merged

@alamb
alamb marked this pull request as ready for review October 21, 2026 20:02
@Jefffrey
Jefffrey merged commit 38c905e into apache:58_maintenance Oct 22, 2026
27 checks passed
@Jefffrey
Jefffrey deleted the backport_11311_58 branch October 22, 2026 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow-core Core crates related to representing arrow data bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants