Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val str = sc.textFile("README.md");
- val withIndex = str.flatMap(x => x.split(" "))
- .filter(_ != "")
- .map(x => {if(x.charAt(x.length-1) == ',') x.slice(0, x.length-1) else x})
- .filter(_.length < 10).map((_,1))
- .reduceByKey(_ + _)
- .sortBy(_._2)
- .zipWithIndex();
- val len = withIndex.collect.length;
- withIndex.filter(x => x._2 > len - 6).map(_._1._1).collect();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement