-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(python): Add ArrowDeviceArray extension to Python bindings (#313)
This PR adds basic support for wrapping the `ArrowDeviceArray` in nanoarrow Python. You have to try pretty hard to get anything that isn't a CPU array here, but 99% of this is just to get a `repr()` and make the device array easier to debug/understand. In some future the CUDA and Metal implementations could live in separate Python packages as well. ```python import nanoarrow.device import pyarrow as pa nanoarrow.device.device_array( pa.record_batch([pa.array([1, 2, 3])], ["col"]) ) ``` ``` <nanoarrow.device.DeviceArray> - device_type: 1 - device_id: 0 - array: <nanoarrow.Array struct> - length: 3 - offset: 0 - null_count: 0 - buffers: (0,) - dictionary: NULL - children[1]: 'col': <nanoarrow.Array int64> - length: 3 - offset: 0 - null_count: 0 - buffers: (0, 5698482274496) - dictionary: NULL - children[0]: ``` Most of the code changes here are to add the appropriate reprs for the `Array` and `Schema` objects. These should work for both CPU and Device flavours of the C Data interface. @jorisvandenbossche the reprs should make it easier for your `__arrow_c_array__` / `__arrow_c_schema__` testing! --------- Co-authored-by: Joris Van den Bossche <[email protected]>
- Loading branch information
1 parent
2d28306
commit fda87c5
Showing
12 changed files
with
521 additions
and
50 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.