kylebarron opened a new issue, #752: URL: https://github.com/apache/datafusion-python/issues/752
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.** The [Arrow PyCapsule Interface](https://arrow.apache.org/docs/format/CDataInterface/PyCapsuleInterface.html) is a new spec to simplify Arrow interop between compiled Python libraries. For example, there's a `from_arrow_table` method https://github.com/apache/datafusion-python/blob/faa5a3f5352342328e183cbeceb3219d7bd05ff8/src/context.rs#L467-L473 but this narrowly allows only _pyarrow Table_ objects (it expects a `to_batches` method). A `from_arrow` method that looks for the `__arrow_c_stream__` method would work _out of the box_ on any Arrow-based Python library implementing this spec. That includes pyarrow `Table`s and `RecordBatchReader`s, ibis Tables (https://github.com/ibis-project/ibis/pull/9143), [nanoarrow objects](https://github.com/apache/arrow-nanoarrow), and hopefully soon duckdb and polars objects as well (https://github.com/pola-rs/polars/issues/12530). Implementing `__arrow_c_stream__` on datafusion exports means that any of those other libraries would _just work_ on datafusion classes, without needing to know anything specific of datafusion. **Describe the solution you'd like** PyCapsule _import_ has been implemented in arrow upstream, but export hasn't been implemented. I've implemented import and export in [pyo3-arrow](https://docs.rs/pyo3-arrow/latest/pyo3_arrow/) (separated for a [few reasons](https://docs.rs/pyo3-arrow/latest/pyo3_arrow/#why-not-use-arrow-rss-python-integration)). I'm not sure if datafusion-python wants another dependency, but the content of pyo3-arrow could also be copied into here. Exporting raw pycapsule objects could be implemented in upstream `arrow` if preferred. **Describe alternatives you've considered** **Additional context** -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
