Skip to content

Commit dae501d

Browse files
committed
Fix async iterator implementation in DataFrame for compatibility with Python < 3.10
1 parent 13ebaf9 commit dae501d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

python/datafusion/dataframe.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,11 +1153,10 @@ def __iter__(self) -> Iterator[RecordBatch]:
11531153
def __aiter__(self) -> AsyncIterator[RecordBatch]:
11541154
"""Return an async iterator over this DataFrame's record batches.
11551155
1156-
`RecordBatchStream` implements ``__aiter__``, so return the stream
1157-
directly to remain compatible with Python < 3.10 (this project
1158-
supports Python >= 3.6).
1156+
We're using __aiter__ becaause we support Python < 3.10 where aiter() is not
1157+
available.
11591158
"""
1160-
return self.execute_stream()
1159+
return self.execute_stream().__aiter__()
11611160

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

0 commit comments

Comments
 (0)