Implement Arrow C device API#305
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for the Arrow C Device Data Interface (device arrays + device array streams) in the C# Arrow implementation, along with new unit tests and Python interop tests (via Python.NET) to validate behavior.
Changes:
- Introduces
CArrowDeviceArray,CArrowDeviceArrayStream, andArrowDeviceTypeplus import/export helpers for arrays, record batches, and streams. - Adds a
CArrowDeviceArrayStreamimporter/exporter to round-tripIArrowArrayStreamthrough the device stream ABI (CPU-only for now). - Adds new C# tests and Python interop tests, and refactors Python.NET initialization into a shared xUnit collection fixture.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| test/Apache.Arrow.Tests/PythonNetFixture.cs | Adds shared Python.NET initialization + skip/throw logic for Python interop tests. |
| test/Apache.Arrow.Tests/PythonNetCollection.cs | Defines xUnit collection to share PythonNetFixture across Python interop tests. |
| test/Apache.Arrow.Tests/CDeviceDataInterfaceTests.cs | Adds managed tests for device array + device stream export/import and CPU-only enforcement. |
| test/Apache.Arrow.Tests/CDeviceDataInterfacePythonTests.cs | Adds PyArrow interop tests for the device data interface. |
| test/Apache.Arrow.Tests/CDataInterfacePythonTests.cs | Switches existing Python tests to the shared Python.NET fixture/collection. |
| src/Apache.Arrow/C/ArrowDeviceType.cs | Adds Arrow device type enum values per the C Device Data Interface spec. |
| src/Apache.Arrow/C/CArrowDeviceArray.cs | Adds struct + allocation helpers for ArrowDeviceArray (device-aware array export container). |
| src/Apache.Arrow/C/CArrowDeviceArrayExporter.cs | Exports IArrowArray/RecordBatch to CArrowDeviceArray (CPU-only fields). |
| src/Apache.Arrow/C/CArrowDeviceArrayImporter.cs | Imports CArrowDeviceArray into IArrowArray/RecordBatch (CPU-only). |
| src/Apache.Arrow/C/CArrowDeviceArrayStream.cs | Adds struct + allocation helpers for ArrowDeviceArrayStream ABI struct. |
| src/Apache.Arrow/C/CArrowDeviceArrayStreamExporter.cs | Exports IArrowArrayStream to CArrowDeviceArrayStream (CPU-only). |
| src/Apache.Arrow/C/CArrowDeviceArrayStreamImporter.cs | Imports CArrowDeviceArrayStream into IArrowArrayStream (CPU-only). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
(I'm sorry for abusing your patience with all these PRs, @adamreeve) |
Contributor
No worries, it's nice to see all these improvements landing! |
adamreeve
approved these changes
Apr 2, 2026
Contributor
adamreeve
left a comment
There was a problem hiding this comment.
Looks good to me thanks Curt
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
Implement Arrow C device API
Closes #299.