@@ -295,7 +295,7 @@ class DataFrame:
295295 up the plan without executing it, and results are only materialized during a
296296 terminal operation (for example, :py:meth:`collect`, :py:meth:`show`, or
297297 :py:meth:`to_pandas`) or when iterating over the DataFrame, which yields
298- :class:`pyarrow .RecordBatch` objects lazily.
298+ :py: class:`~datafusion.record_batch .RecordBatch` objects lazily.
299299
300300 See :ref:`user_guide_concepts` in the online documentation for more information.
301301 """
@@ -1134,25 +1134,16 @@ def __arrow_c_stream__(self, requested_schema: object | None = None) -> object:
11341134 return self .df .__arrow_c_stream__ (requested_schema )
11351135
11361136 def __iter__ (self ) -> Iterator [RecordBatch ]:
1137- """Yield :class:`datafusion.record_batch.RecordBatch` objects lazily.
1137+ """Yield record batches from this DataFrame lazily.
11381138
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.
1139+ This delegates to :py:meth:`to_stream` without eagerly materializing the
1140+ entire result set.
11431141 """
1144- for batch in self .to_stream ():
1145- yield batch
1142+ return iter (self .to_stream ())
11461143
11471144 def __aiter__ (self ) -> AsyncIterator [RecordBatch ]:
1148- """Asynchronously yield :class:`datafusion.record_batch.RecordBatch` objects lazily."""
1149- stream = self .to_stream ()
1150-
1151- async def iterator () -> AsyncIterator [RecordBatch ]:
1152- async for batch in stream :
1153- yield batch
1154-
1155- return iterator ()
1145+ """Asynchronously yield record batches from this DataFrame lazily."""
1146+ return self .to_stream ()
11561147
11571148 def transform (self , func : Callable [..., DataFrame ], * args : Any ) -> DataFrame :
11581149 """Apply a function to the current DataFrame which returns another DataFrame.
0 commit comments