[SPARK-2006] Spark Sql example throws ClassCastException: Long -> Int

This fixes an example spark sql program which failed at the getInt() call.
getInt() was called on a COUNT query whose output datatype is of type Long and casting a Long to Int is an illegal operation

In this commit:
* use getLong(0) instead of getInt(0)
* Fix typos in comments
* add call parens to collect() call for consistency

For the future, I think it would be good to have all the example programs be automatically run and checked for successful exit codes as part of the CI run so that something like this doesn't slip through