[SPARK-2059][SQL] Add analysis checks

An initial version of analysis checks.  Long term we are going to want something more complete, but this at least prevents us from making it all the way execution with obvious problems.  For example, doing a sort on a misspelled attribute is actually enough to kill the DAG scheduler.
```if p.expressions.exists(!_.resolved)```