We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 44415b9 commit b9edf12Copy full SHA for b9edf12
examples/src/main/scala/org/apache/spark/examples/DFSReadWriteTest.scala
@@ -124,11 +124,14 @@ object DFSReadWriteTest {
124
println("Reading file from DFS and running Word Count")
125
val readFileRDD = sc.textFile(dfsFilename)
126
127
- val dfsWordCount = readFileRDD.flatMap {
128
- ln => ln.split(" ") }.flatMap {
129
- ln => ln.split("\t") }.filter {
130
- ln => ln.size > 0 }.map {
131
- w => (w, 1) }.countByKey().values.sum
+ val dfsWordCount = readFileRDD
+ .flatMap(_.split(" "))
+ .flatMap(_.split("\t"))
+ .filter(_.size > 0)
+ .map(w => (w, 1))
132
+ .countByKey()
133
+ .values
134
+ .sum
135
136
sc.stop()
137
0 commit comments