Javi

Spark: example in python

Feb 21st, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. my_RDD = spark.textFile("hdfs://...")
  2. words = my_RDD.flatMap(lambda line : line.split(" "))
  3. .map(lambda word : (word, 1))
  4. .reduceByKey(lambda a, b : a + b)
  5. words.saveAsTextFile("hdfs://...")
Advertisement
Add Comment
Please, Sign In to add comment