Skip to content

Commit b9edf12

Browse files
committed
Fix spark wc style
1 parent 44415b9 commit b9edf12

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

examples/src/main/scala/org/apache/spark/examples/DFSReadWriteTest.scala

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,14 @@ object DFSReadWriteTest {
124124
println("Reading file from DFS and running Word Count")
125125
val readFileRDD = sc.textFile(dfsFilename)
126126

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
127+
val dfsWordCount = readFileRDD
128+
.flatMap(_.split(" "))
129+
.flatMap(_.split("\t"))
130+
.filter(_.size > 0)
131+
.map(w => (w, 1))
132+
.countByKey()
133+
.values
134+
.sum
132135

133136
sc.stop()
134137

0 commit comments

Comments
 (0)