wjones127 commented on code in PR #37797:
URL: https://github.com/apache/arrow/pull/37797#discussion_r1353039199
##########
python/pyarrow/table.pxi:
##########
@@ -2983,6 +2985,101 @@ cdef class RecordBatch(_Tabular):
<ArrowArray*> c_ptr, c_schema))
return pyarrow_wrap_batch(c_batch)
+ def __arrow_c_array__(self, requested_schema=None):
+ """
+ Get a pair of PyCapsules containing a C ArrowArray representation of
the object.
+
+ Parameters
+ ----------
+ requested_schema : PyCapsule | None
+ A PyCapsule containing a C ArrowSchema representation of a
requested
+ schema. PyArrow will attempt to cast the batch to this schema.
+ If None, the schema will be returned as-is, with a schema matching
the
+ one returned by :meth:`__arrow_c_schema__()`.
+
+ Returns
+ -------
+ Tuple[PyCapsule, PyCapsule]
+ A pair of PyCapsules containing a C ArrowSchema and ArrowArray,
+ respectively.
+ """
+ cdef:
+ ArrowArray* c_array = <ArrowArray*> malloc(sizeof(ArrowArray))
+ ArrowSchema* c_schema = <ArrowSchema*> malloc(sizeof(ArrowSchema))
Review Comment:
Thanks. I like that API.
--
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]