pitrou commented on code in PR #37797:
URL: https://github.com/apache/arrow/pull/37797#discussion_r1352004534
##########
python/pyarrow/ipc.pxi:
##########
@@ -815,6 +817,73 @@ cdef class RecordBatchReader(_Weakrefable):
self.reader = c_reader
return self
+ def __arrow_c_stream__(self, requested_schema=None):
+ """
+ Export to a C ArrowArrayStream PyCapsule.
+
+ Parameters
+ ----------
+ requested_schema: Schema, default None
+ The schema to which the stream should be casted. Currently, this is
+ not supported and will raise a NotImplementedError if the schema
+ doesn't match the current schema.
+
+ Returns
+ -------
+ PyCapsule
+ A capsule containing a C ArrowArrayStream struct.
+ """
+ cdef:
+ ArrowArrayStream* c_stream
+
+ if requested_schema is not None:
+ out_schema = Schema._import_from_c_capsule(requested_schema)
+ # TODO: figure out a way to check if one schema is castable to
Review Comment:
There is `arrow::compute::CanCast` function that works on datatypes, and a
`Schema::AreCompatible` method that works on schemas. Can you open a followup
issue for this?
--
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]