Which function in spark is used to combine two RDDs by keys

后端 未结 2 1606
鱼传尺愫
鱼传尺愫 2021-01-07 19:05

Let us say I have the following two RDDs, with the following key-pair values.

rdd1 = [ (key1, [value1, value2]), (key2         


        
2条回答
  •  滥情空心
    2021-01-07 19:56

    Just use join and then map the resulting rdd.

    rdd1.join(rdd2).map(case (k, (ls, rs)) => (k, ls ++ rs))
    

提交回复
热议问题