fix: Preserve schema metadata in RecordBatch PyCapsule export#474
Merged
kylebarron merged 1 commit intokylebarron:mainfrom Feb 11, 2026
Merged
Conversation
Owner
|
Ah the test is probably failing because the repo is half way through an update in pyo3 version. So arro3 is currently pinned to a git hash of pyo3-arrow |
Contributor
Author
|
yeah, I had to comment out a bunch of stuff locally to get it to build. Wasn't sure how to approach it |
Owner
|
The right way is to bump the pyo3 version at the root and use pyo3-arrow as a path dependency. You're welcome to try or I can get to it tomorrow |
Contributor
Author
|
I couldn't get it to work. Keen to see your commit when you do! |
Owner
Owner
|
You should be able to merge in main now |
…rron#473) `to_array_pycapsules` was dropping schema-level metadata because `Field::new_struct()` creates a field with empty metadata. Chain `.with_metadata()` to carry it through, matching the pattern already used in `to_struct_array()`. Closes kylebarron#473
f0d7f76 to
caebae3
Compare
Owner
|
Thanks! |
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.
Summary
to_array_pycapsulesdropping schema-level metadata by chaining.with_metadata()onto theField::new_struct()call, matching the pattern already used into_struct_array()RecordBatchwith metadata through pyarrow via PyCapsule exportCloses #473
Test plan
main(metadata isNoneafter round-trip)test_record_batch.pytests passcargo clippy -p pyo3-arrowclean