Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pyspark import SparkContext, SparkConf
- sparkConf = SparkConf().setAppName("CCA 175 Problem 84")
- sc = SparkContext(conf = sparkConf)
- contentRDD = sc.textFile("Content.txt")
- nonEmptyLines = sc.filter(lambda line: len(line) > 0)
- words = nonEmptyLines.flatMap(lambda x: x.split(" "))
- finalRDD = words.filter(lambda x: len(x) > 2)
- for word in finalRDD:
- print(word)
- finalRDD.saveAsTextFile("problem84")
- spark-submit -master yarn problem84.py
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement