You should look at how fold is used in scala in general to help. Here is a
blog post that may also give some guidance:
http://blog.madhukaraphatak.com/spark-rdd-fold

The zero value should be your bean, with the 4th parameter set to the
minimum value. Your fold function should compare the 4th param in the
incoming records and chose the larger one.

If you want to group by the 3 parameters prior to folding you're probably
better off using a reduce function.

On Fri, Oct 31, 2014 at 12:01 PM, Ron Ayoub <ronalday...@live.com> wrote:

> I'm want to fold an RDD into a smaller RDD with max elements. I have
> simple bean objects with 4 properties. I want to group by 3 of the
> properties and then select the max of the 4th. So I believe fold is the
> appropriate method for this. My question is, is there a good fold example
> out there. Additionally, what it the zero value used for as the first
> argument? Thanks.
>

Reply via email to