I am now doing some operations using GraphX and want something like this
val ans = graph.triplets.map(
e => {
if (conditon1){
return ans_1 to RDD_1
}
else (condition2){
return ans_2 to RDD_2
}
}
)
I know I can use double runs of graph.triplets.map
to return 2 different RDD, like this
val RDD_1 = graph.triplets.map(
e => {
if (conditon1){
return ans_1
}
})
val RDD_2 = graph.triplets.map(
e => {
if (condition2){
return ans_2
}
})
However in order to improve the efficiency I want to do it in a single run as I depicted above. How can I achieve it?