reduce() vs. fold() in Apache Spark

Viewed 8067

What is the difference between reduce vs. fold with respect to their technical implementation?

I understand that they differ by their signature as fold accepts additional parameter (i.e. initial value) which gets added to each partition output.

  • Can someone tell about use case for these two actions?
  • Which would perform better in which scenario consider 0 is used for fold?

Thanks in advance.

1 Answers
Related