SHARE
TWEET

Untitled

a guest Jul 19th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. val str = sc.textFile("README.md");
  2.  
  3. val withIndex = str.flatMap(x => x.split(" "))
  4.     .filter(_ != "")
  5.     .map(x => {if(x.charAt(x.length-1) == ',') x.slice(0, x.length-1) else x})
  6.     .filter(_.length < 10).map((_,1))
  7.     .reduceByKey(_ + _)
  8.     .sortBy(_._2)
  9.     .zipWithIndex();
  10.  
  11. val len = withIndex.collect.length;
  12.  
  13. withIndex.filter(x => x._2 > len - 6).map(_._1._1).collect();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top