:: DeveloperApi ::
A TaskContext aware iterator.
As the Python evaluation consumes the parent iterator in a separate thread,
it could consume more data from the parent even after the task ends and the parent is closed.
If an off-heap access exists in the parent iterator, it could cause segmentation fault
which crashes the executor.
Thus, we should use ContextAwareIterator to stop consuming after the task ends.
(Changed in version 2.8.0) collect has changed. The previous behavior can be reproduced with toSeq.