ragrawal.wordpress.com
Spark: Custom UDAF Example
This post shows how to extend dataframe functionality by writing custom aggregate function in spark >= 1.5.1