Hyukjin Kwon created SPARK-61160:
------------------------------------
Summary: Close the local iterator of toLocalIterator as a
generator, so contextlib.closing and close() end the execution in the Python
client as PySpark does
Key: SPARK-61160
URL: https://issues.apache.org/jira/browse/SPARK-61160
Project: Spark
Issue Type: Bug
Components: Connect
Affects Versions: connect-rust-4.3.0
Reporter: Hyukjin Kwon
df.toLocalIterator() returns a LocalRowIterator with only __iter__ and
__next__, so contextlib.closing(it) and it.close() raise AttributeError:
'LocalRowIterator' object has no attribute 'close'. PySpark returns a
generator, whose close() ends the iteration and releases the execution early,
and whose next() then raises StopIteration. The fix adds close() to
LocalRowIterator, which drops the stream and ends the iteration; closing it
again does nothing.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]