In a spark program I first initialised 2 RDDs and then used the 2nd RDD in a while loop as follows:
var nodes = sc.parallelize(ArrayBuffer(1, 2, 3, 4, 5))
var node_GroupIDs = nodes.map(x=>(x, UUID.randomUUID()))
var i = 0
while (i < 10) {
node_GroupIDs.foreach(println)
i += 1
}
I found in different iterations for a certain node ID the corresponding group ID has different value. It seems that in each iteration the RDD had been initialized again. How to assign a fixed UUID value to a node in this case?