Github user MLnick commented on the issue:
https://github.com/apache/spark/pull/14579
@nchammas I looked at the `@contextmanager` decorator. It is an easy way to
create a method that returns a context manager, but is is essentially _only_
usable in a `with` statement as it returns a
`contextlib.GeneratorContextManager`. For this use case it does not solve the
issue that we need to return the RDD/DF instance from `cache`.
As far as I can see for the `closing` helper function, it is just a
[context manager
itself](https://github.com/python/cpython/blob/master/Lib/contextlib.py#L163),
so the same as the final variant for option (a) mentioned above, i.e. `with
cached(rdd) as ...`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]