Skip to content

Commit 4c21260

Browse files
Update reduceExample.scala
1 parent fe89391 commit 4c21260

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/scala/com/sparkbyexamples/spark/rdd/functions/reduceExample.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ object reduceExample extends App {
1313

1414
val listRdd = spark.sparkContext.parallelize(List(1,2,3,4,5,3,2))
1515

16-
println("output sum using binary : "+listRdd.reduce(_ min _))
17-
println("output min using binary : "+listRdd.reduce(_ max _))
18-
println("output max using binary : "+listRdd.reduce(_ + _))
16+
println("output min using binary : "+listRdd.reduce(_ min _))
17+
println("output max using binary : "+listRdd.reduce(_ max _))
18+
println("output sum using binary : "+listRdd.reduce(_ + _))
1919

2020

2121
// Alternatively you can write
@@ -27,7 +27,7 @@ object reduceExample extends App {
2727
val inputRDD = spark.sparkContext.parallelize(List(("Z", 1),("A", 20),("B", 30),
2828
("C", 40),("B", 30),("B", 60)))
2929

30-
println("output max : "+inputRDD.reduce( (a,b)=> ("max",a._2 min b._2))._2)
30+
println("output min : "+inputRDD.reduce( (a,b)=> ("max",a._2 min b._2))._2)
3131
println("output max : "+inputRDD.reduce( (a,b)=> ("max",a._2 max b._2))._2)
3232
println("output sum : "+inputRDD.reduce( (a,b)=> ("Sum",a._2 + b._2))._2)
3333
}

0 commit comments

Comments
 (0)