File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,6 +46,14 @@ def to_pyarrow(self) -> pa.RecordBatch:
4646 """Convert to :py:class:`pa.RecordBatch`."""
4747 return self .record_batch .to_pyarrow ()
4848
49+ def __arrow__ (self , * args : object , ** kwargs : object ) -> pa .RecordBatch :
50+ """Return a :py:class:`pa.RecordBatch` for Arrow interoperability.
51+
52+ This enables ``datafusion.record_batch.RecordBatch`` instances to be
53+ automatically recognized by PyArrow when passed to its APIs.
54+ """
55+ return self .to_pyarrow ()
56+
4957 def __arrow_c_array__ (
5058 self , requested_schema : object | None = None
5159 ) -> tuple [object , object ]:
Original file line number Diff line number Diff line change @@ -79,6 +79,10 @@ impl PyRecordBatch {
7979 self . batch . to_pyarrow ( py)
8080 }
8181
82+ fn __arrow__ ( & self , py : Python ) -> PyResult < PyObject > {
83+ self . to_pyarrow ( py)
84+ }
85+
8286 #[ pyo3( signature = ( requested_schema=None ) ) ]
8387 fn __arrow_c_array__ < ' py > (
8488 & self ,
You can’t perform that action at this time.
0 commit comments