Repository navigation
Preserve rows when concatenating pandas ArrayXD batches - #8867
Open
pavanmudumba wants to merge 2 commits into
Open
pavanmudumba wants to merge 2 commits into
pavanmudumba wants to merge 2 commits into
Conversation
Contributor
Author
|
Hi! Following up on this fix when you have a chance to review. It preserves row counts and shapes when concatenating pandas ArrayXD batches, with regression coverage for dense, ragged, empty, and null-containing inputs. The reproduction and local test results are in the description. Happy to adjust the implementation or add any further coverage you’d find useful. Thanks for your time! |
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.
PandasArrayExtensionArray._concat_same_typecan turn whole input batches into individual rows. For example, concatenating dense batches with 2 and 1 rows returns 2 rows instead of 3, with an extra batch dimension inside each row. A single input chunk is also wrapped as one row. Equally sized object-backed chunks take thevstackbranch and gain an extra dimension.Reproduction:
Compare each chunk's per-row shape rather than its full batch shape, and concatenate compatible backing arrays along axis 0. For mixed dense/object-backed chunks, allocate one object slot per input row and copy rows individually. This preserves ragged arrays and null rows without retaining the batch grouping.
Added 24 regression/control cases covering unequal and equal batch lengths, a single chunk, empty chunks, int32/float32, Array2D/Array3D, ragged arrays, mixed dense/object storage, null rows, and conversion back to Arrow. Tests exercise the extension-array concatenation hook directly; the separate pandas dtype-comparison issue is tracked in #8375 and #8464.
Validation on Windows / Python 3.12:
python -m pytest tests/features/test_array_xd.py tests/test_formatting.py -q -rs: 155 passed, 29 skipped for optional dependencies or platform requirements. A short--basetemppath avoids Windows cache-lock filename limits.git diff --checkpasses.