January 2019
Beginner to intermediate
154 pages
4h 31m
English
This applies a given function that returns an iterator to each element of an RDD and returns a new RDD with more elements. In some cases, you might need multiple elements from a single element. For example, in the following code, an RDD containing lines is converted into another RDD containing words:
#Pythonspark.sparkContext.parallelize(["It's fun to learn Spark","This is a flatMap example using Python"]).flatMap(lambda x : x.split(" ")).collect()
The following code performs the same operation in Scala:
//Scalaspark.sparkContext.parallelize(Array("It's fun to learn Spark","This is a flatMap example using Python")).flatMap(x => x.split(" ")).collect()
Read now
Unlock full access