Analysis code for Spark.