I am running some attribute lookup problems when trying to initiate a class within my RDD.
my workflow:
1- Start with an RDD
2- Take each element of the RDD, initiate an object for each
3- Reduce (I will write a method that will define the reduce operation later on)
Here is #2:
>class test(object):
def __init__(self, a,b):
self.total = a + b
>a = sc.parallelize([(True,False),(False,False)])
>a.map(lambda (x,y): test(x,y))
Here is the error I get:
PicklingError: Can't pickle < class 'main.test' >: attribute lookup main.test failed
I'd like to know if there is any way around it. Please, answer with a working example to achieve the intended results (i.e. creating a RDD of objects of class "tests").
Related questions: