Registrations Closing Soon for DevOps Certification Training by CloudxLab | Registrations Closing in

  Enroll Now

Apache Spark - Reduce, Commutative & Associative

INSTRUCTIONS
  • More Actions - Reduce()

    var seq = sc.parallelize(1 to 100)
    def sum(x: Int, y:Int):Int = {return x+y}
    var total = seq.reduce(sum);
    

    and

    sum(1,3)
    
  • Using reduce for avg()

    var seq = sc.parallelize(Array(3.0, 7, 13, 16, 19))
    def avg(x: Double, y:Double):Double = {return (x+y)/2}
    var total = seq.reduce(avg);
    

No hints are availble for this assesment

Answer is not availble for this assesment

Loading comments...