Github user hvanhovell commented on a diff in the pull request: https://github.com/apache/spark/pull/16168#discussion_r91064259 --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala --- @@ -126,6 +146,55 @@ private[hive] class HiveMetastoreCatalog(sparkSession: SparkSession) extends Log } } + /** + * Apply Projection on unresolved logical plan to: + * 1. Omit the columns which are not referenced by the view; + * 2. Reorder the columns to keep the same order with the view; + */ + private def withProjection(plan: LogicalPlan, schema: StructType): LogicalPlan = { + // All fields in schema should exist in plan.schema, or we should throw an AnalysisException + // to notify the underlying schema has been changed. + if (schema.fields.forall { field => --- End diff -- It took me while to figure out what was going on here. Please restructure this. You could just do the check in a different code block since you are throwing an exception.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org