Skip to content

Commit 13ebaf9

Browse files
committed
Update async iterator implementation in DataFrame to ensure compatibility with Python < 3.10
1 parent 848665e commit 13ebaf9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

python/datafusion/dataframe.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,8 +1151,13 @@ def __iter__(self) -> Iterator[RecordBatch]:
11511151
return iter(self.execute_stream())
11521152

11531153
def __aiter__(self) -> AsyncIterator[RecordBatch]:
1154-
"""Return an async iterator over this DataFrame's record batches."""
1155-
return aiter(self.execute_stream())
1154+
"""Return an async iterator over this DataFrame's record batches.
1155+
1156+
`RecordBatchStream` implements ``__aiter__``, so return the stream
1157+
directly to remain compatible with Python < 3.10 (this project
1158+
supports Python >= 3.6).
1159+
"""
1160+
return self.execute_stream()
11561161

11571162
def transform(self, func: Callable[..., DataFrame], *args: Any) -> DataFrame:
11581163
"""Apply a function to the current DataFrame which returns another DataFrame.

0 commit comments

Comments
 (0)