Repository navigation
fix: Concatenate extension arrays and keep concatenated results valid after inputs are disposed - #444
Merged
CurtHagenlocher merged 1 commit intoSep 27, 2026
Conversation
… after inputs are disposed - Concatenate extension arrays by concatenating their storage and re-applying the extension type. - Retain the variadic data buffers a concatenated view array shares with its inputs, and skip empty inputs consistently when counting and copying those buffers. - Retain the input when the result would otherwise alias it: a single input, a single non-empty nested child, or the empty child used when every input is empty. Closes apache#443. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The reviewed changes are covered by regression tests and have no unresolved blocking issues.
Review effort: Lite
Findings: None
What changed in this PR
Fixes ArrowArrayConcatenator support for extension arrays and preserves result validity after input disposal.
Changes:
- Adds extension-array concatenation and validation.
- Retains view and aliased buffers safely.
- Adds regression tests for lifetime and empty-input cases.
| File | Description |
|---|---|
test/Apache.Arrow.Tests/ArrowArrayConcatenatorTests.cs |
Adds extension, view, and lifetime regression tests. |
src/Apache.Arrow/Arrays/ArrowArrayConcatenator.cs |
Retains data for single-input results. |
src/Apache.Arrow/Arrays/ArrayDataConcatenator.cs |
Implements extension concatenation and buffer ownership fixes. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
What's Changed
Fixes the three
ArrowArrayConcatenatorproblems reported in #443, plus a related lifetime issue found while fixing them.ExtensionType.Acceptpasses the visitor through to the storage type, so the storage visitor then rejected theExtensiontype ID.ArrayDataConcatenator.Concatenatenow checks for an extension type first. It requires every input to have the same extension name and metadata, concatenates the storage arrays, and puts the extension type back on the result. This path also applies to child arrays, so e.g. a list ofGuidArrays works too.ConcatenateBinaryViewArrayDatanow callsRetain()on each variadic data buffer it takes from an input. The result stays valid after the inputs (includingSliceSharedinputs) are disposed.ConcatenateViewBufferalready did when counting them. The buffer count and the view buffer indices now match.Concatenatemethod, a nested child where only one input contributed values (for example, lists where only one has values), and the zero-length child or values array used when every input is empty. These now useRetain()/SliceShared(0, 0).Note: a single-input
Concatenatecall now returns a new array that holds its own references, not the input object itself. The caller should dispose it like any other concatenation result.Tests
Eight new tests in
ArrowArrayConcatenatorTestscover extension arrays (plain, nested in a list, mismatched types), view results that outlive their inputs (plain andSliceShared), empty view inputs with data buffers, and results that outlive a single input, a list with one non-empty input, and a run-end encoded array with one non-empty input. All eight fail without the fix. The fullApache.Arrow.Testssuite passes on net8.0, net462 and net472.Closes #443.
🤖 Generated with Claude Code