scala> val file=sc.textFile("/workspace/bpUserinfo_logs/bpUserinfo_20160212.log")
scala> val count=file.flatMap(line => line.split(" ")).map(word => (word,1)).reduceByKey(_+_)
scala> count.collect().map(print)
时间: 2024-10-06 07:01:21
scala> val file=sc.textFile("/workspace/bpUserinfo_logs/bpUserinfo_20160212.log")
scala> val count=file.flatMap(line => line.split(" ")).map(word => (word,1)).reduceByKey(_+_)
scala> count.collect().map(print)