score:2

don't forget that vals are immutable, this means that you can't reassign something to a previously defined variable. however if you want to do this, you can replace it for a var, which is not recommended, this question is more related to scala's feature than to apache-spark's one. besides, if you want more information you can consult this post use of def val and vars in scala.

score:3

the compiler is telling you that you're attempting to define a variable with itself and use it in it's own definition within an action. to say this another way, you're attempting to use something that doesn't exist in an action to define it.

edit:

if you have a list of actions that produce new rdd that you'd like to zip together, perhaps you should look at a fold:

listmyactions.foldleft(origrdd){ (rdd, f) =>
  val temprdd = f(rdd)
  rdd.zip(temprdd)
}

Related Query

More Query from same tag