Repository navigation
Core: Export tables and scans as Arrow C streams - #4484
Open
Anurag-S1ngh wants to merge 1 commit into
Open
Anurag-S1ngh wants to merge 1 commit into
Anurag-S1ngh wants to merge 1 commit into
Conversation
Implement __arrow_c_stream__ on Table, DataScan, and IncrementalAppendScan so Arrow consumers can read them without calling to_arrow(). Part of apache#1655; the write side is tracked in apache#2680.
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
PyIceberg can read Arrow data through
to_arrow()andto_arrow_batch_reader(), but its own table and scan objects cannot be consumed by other Arrow-native libraries without an explicit PyArrow conversion.This implements the producer side of the Arrow PyCapsule interface from #1655.
Table,DataScan, andIncrementalAppendScannow expose__arrow_c_stream__, which delegates toto_arrow_batch_reader()so scans keep streaming and keep their existing filter, projection, and limit behavior.The base scan classes are unchanged, so third-party scan subclasses do not need to implement a new abstract method.
The write side is tracked separately in #2680.
Closes #1655.
Are these changes tested?
Yes. Added
tests/table/test_arrow_capsule.pycovering:consuming a
Tabledirectly withpa.table(...)consuming a filtered and projected scan
consuming an incremental append scan
pytest tests/ -m unit --ignore=tests/integration: 4885 passed, 6 skippedruff checkandruff format --checkpassty checkreports nothing for the new methodsAre there any user-facing changes?
Yes.
Table,DataScan, andIncrementalAppendScannow support the Arrow PyCapsule stream interface. Existingto_arrow()andto_arrow_batch_reader()APIs are unchanged.