Calculating average with Spark