@@ -1133,23 +1133,24 @@ def __arrow_c_stream__(self, requested_schema: object | None = None) -> object:
11331133 # preserving the original partition order.
11341134 return self .df .__arrow_c_stream__ (requested_schema )
11351135
1136- def __iter__ (self ) -> Iterator [pa . RecordBatch ]:
1137- """Yield record batches from this DataFrame lazily.
1136+ def __iter__ (self ) -> Iterator [RecordBatch ]:
1137+ """Yield :class:`datafusion.record_batch.RecordBatch` objects lazily.
11381138
1139- This delegates to :py:meth:`to_stream` and converts each batch to a
1140- :class:`pyarrow.RecordBatch` without eagerly materializing the entire
1141- result set.
1139+ This delegates to :py:meth:`to_stream` without converting each batch to a
1140+ :class:`pyarrow.RecordBatch`. Use
1141+ :py:meth:`datafusion.record_batch.RecordBatch.to_pyarrow` when a
1142+ :class:`pyarrow.RecordBatch` is required.
11421143 """
11431144 for batch in self .to_stream ():
1144- yield batch . to_pyarrow ()
1145+ yield batch
11451146
1146- def __aiter__ (self ) -> AsyncIterator [pa . RecordBatch ]:
1147- """Asynchronously yield record batches from this DataFrame lazily."""
1147+ def __aiter__ (self ) -> AsyncIterator [RecordBatch ]:
1148+ """Asynchronously yield :class:`datafusion.record_batch.RecordBatch` objects lazily."""
11481149 stream = self .to_stream ()
11491150
1150- async def iterator () -> AsyncIterator [pa . RecordBatch ]:
1151+ async def iterator () -> AsyncIterator [RecordBatch ]:
11511152 async for batch in stream :
1152- yield batch . to_pyarrow ()
1153+ yield batch
11531154
11541155 return iterator ()
11551156
0 commit comments