I have rdd of two strings JoindStrings: RDD[(String, String)] and I need to calculate the similarity between each pair of strings
I tried this:

```
val similarPairsRdd: RDD[(String, String, Double)] = 
    JoindStrings.map(x => (x._1, x._2, getSimilarity(x._1, x._2)))

```

The function `getSimilarity` takes two strings and return double
I have an exception in thread "main"

> 
> org.apache.spark.SparkException: Task not serializable
> 
> 
> 

Also, i tried `JoindStrings.map.collect()(x => ...` but it gives me array not rdd
Is there any solution for this exception?