[SPARK-4469] [SQL] Move the SemanticAnalyzer from Physical Execution to Analysis

This is the code refactor and follow ups for #2570