Github user hvanhovell commented on a diff in the pull request: https://github.com/apache/spark/pull/16233#discussion_r94689864 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala --- @@ -377,6 +378,39 @@ case class InsertIntoTable( override lazy val resolved: Boolean = childrenResolved && table.resolved } +/** Factory for constructing new `View` nodes. */ +object View { + def apply(desc: CatalogTable): View = View(desc, desc.schema.toAttributes, None) +} + +/** + * A container for holding the view description(CatalogTable), and the output of the view. The + * child will be defined if the view is resolved with Hive support, else it should be None. + * This operator will be removed at the end of analysis stage. + * + * @param desc A view description(CatalogTable) that provides necessary information to resolve the + * view. + * @param output The output of a view operator, this is generated during planning the view, so that + * we are able to decouple the output from the underlying structure. + * @param child The logical plan of a view operator, it should be non-empty if the view is resolved + * with Hive support, else it should be None. + */ +case class View( + desc: CatalogTable, + output: Seq[Attribute], + child: Option[LogicalPlan] = None) extends LogicalPlan with MultiInstanceRelation { + + override lazy val resolved: Boolean = child.exists(_.resolved) + + override def children: Seq[LogicalPlan] = child.toSeq + + override def newInstance(): LogicalPlan = copy(output = output.map(_.newInstance())) --- End diff -- +100
--- 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