Implemented analyzer in service and updated relevant code in Spark.

Implemented analyzer in service and updated relevant code in Spark (squashed commits)

This squashes #1169 

@devoncarew