[SPARK-2041][SQL] Correctly analyze queries where columnName == tableName.