Github user JoshRosen commented on the pull request:
https://github.com/apache/spark/pull/1623#issuecomment-50950663
I came up with a contrived example that doesn't work. Try running the
following with `./bin/pyspark`:
```python
from collections import namedtuple
Person = namedtuple("Person", 'id firstName lastName')
jon = Person(1, "Jon", "Doe")
from pyspark import SparkContext
sc = SparkContext("local")
sc.textFile("/usr/share/dict/words").map(lambda x: jon).first()
```
This results in a pickling error.
The problem here is that `_hack_namedtuple()` is registered too late. What
if you made it into a classmethod in PickleSerializer and called it from
SparkContext.__init__()?
---
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.
---