1# Build the union of a list of RDDs
2
3path = os.path.join(tempdir, "union-text.txt")
4with open(path, "w") as testFile:
5 _ = testFile.write("Hello")
6textFile = sc.textFile(path)
7textFile.collect()
8# ['Hello']
9parallelized = sc.parallelize(["World!"])
10sorted(sc.union([textFile, parallelized]).collect())
11# ['Hello', 'World!']