SPARK-2978. Transformation with MR shuffle semantics

I didn't add this to the transformations list in the docs because it's kind of obscure, but would be happy to do so if others think it would be helpful.
Is this code actually correct? It seems to be passing arguments 3 and 4 of the function, but in positions 1 and 2.