how to merge two RDD to one RDD [duplicate]
问题 This question already has answers here : Concatenating datasets of different RDDs in Apache spark using scala (2 answers) Closed 2 years ago . Help ,I have two RDDs, i want to merge to one RDD.This is my code. val us1 = sc.parallelize(Array(("3L"), ("7L"),("5L"),("2L"))) val us2 = sc.parallelize(Array(("432L"), ("7123L"),("513L"),("1312L"))) 回答1: Just use union: val merged = us1.union(us2) Documentation is here Shotcut in Scala is: val merged = us1 ++ us2 回答2: You need the RDD.union These don