Epic 149: Arrow canonical interchange in Python - #109
Merged
Conversation
PyPointCloud exposes __arrow_c_array__, returning (schema, array) Arrow C Data capsules so PyArrow/pandas consume SpatialRust clouds zero-copy. PyPointCloudStream exposes __arrow_c_stream__ for bounded record streaming into pa.RecordBatchReader via direct ArrowArrayStream callbacks. Capsule destructors call the Arrow release callbacks exactly once, verified by PyArrow round trips and gc no-double-free in the wheel test gate. Add StreamingPipelineIter::schema() accessor and pyarrow to the Python CI job.
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
Promotes Arrow to the canonical cross-language zero-copy interchange in the Python bindings.
Deliverables
PyPointCloud.__arrow_c_array__— returns(arrow_schema, arrow_array)capsules from the audited C Data export, sopa.array(cloud), pandas, and DuckDB consume SpatialRust clouds zero-copy. Field buffers are CPU-backed and shared.PyPointCloudStream.__arrow_c_stream__— returns a singlearrow_array_streamcapsule with directget_schema/get_next/get_last_error/releasecallbacks driving the chunk iterator, consumable bypa.RecordBatchReader.from_stream. Bounded batch sizes are preserved.gc.collect()showing no double free.spatialrust-pipeline::StreamingPipelineIter::schema()additive accessor;pyarrowadded to the Python CI job.Verification
-k arrow_c:pa.array(cloud)struct<float32 x,y,z> matches source; 1000-point stream yields 256/256/256/232 batches whose concatenatedxmatches a direct read.-D warningsclean forspatialrust-pyandspatialrust-pipeline;cargo fmtclean.