Q:

What does .collect() do?

I understand that .collect(pf), where pf is a partial function, is the equivalent to .filter(pf.isDefinedAt _).map(pf). What I don't understand is what just .collect() does. Can anyone explain this?

A:

collect without parameters fetches all data stored in a RDD to the driver.

Return an array that contains all of the elements in this RDD.
Note
This method should only be used if the resulting array is expected to be small, as all the data is loaded into the driver's memory.

There is no connection to the version with PartialFunction whatsoever. Both are used for completely different things.

