Enhance your Knowledge | Flat 25% Discount on all Courses | Use Coupon Code - ENHANCE25 During Checkout |

 Enroll Now

Apache Spark - Key Value RDD

8 / 10

What would the following code do?

var inputdata = List((1,2.0),(1,12.0),(1,4.0), (1, 6.0))
var kvrdd = sc.parallelize(inputdata)
def avg(a:Double, b:Double): Double = {
    return (a+b)/2
}
val out = kvrdd.reduceByKey(avg)
out.collect()