Reduce operations
Reduce operations include fold, aggregate, which are from Scala collection.
-
foldLeftdef foldLeft[B](z: B)(f: (B, A) => B): BIt's the popular choice for reduction in Scala collection.
-
foldRightdef foldRight[B](z: B)(f: (A, B) => B): B -
folddef fold[B](z: B)(f: (B, B) => B): B -
aggregatedef aggregate[B](z: => B)(seqop: (B, A) => B, combop: (B, B) => B)This function combines
foldLeftandfold.-
seqop: Sequential operation -
combop: Combination operation
-
Reduction operations walk through collections and combine neighboring elements together to produce a single combined result.
Reduce operation in RDD
foldLeft and foldRight are not in Spark. So, Spark has:
-
fold -
aggregate
aggregate is the popular choice.