object SimpleApp {
def main(args: Array[String]) {
val conf = new SparkConf().setAppName("Simple Application")
val sc = new SparkContext(conf)
val line = sc.textFile("README.md")
val words = line.flatMap(line => line.split(" "))
val counts = words.map(word => (word, 1)).reduceByKey{case(x, y) => x + y}
counts.saveAsTextFile("result")
sc.stop()
}
}
这是书上的例子,保存在hdfs里的 /user/hadoop/result内容为空这是为啥