cloud-fan commented on a change in pull request #31368:
URL: https://github.com/apache/spark/pull/31368#discussion_r565562297



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala
##########
@@ -450,46 +450,22 @@ case class InsertIntoDir(
  *
  * @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 a logical 
plan parsed from the
  *              `CatalogTable.viewText`, should throw an error if the 
`viewText` is not defined.
  */
 case class View(
     desc: CatalogTable,
     isTempView: Boolean,
-    output: Seq[Attribute],
-    child: LogicalPlan) extends LogicalPlan with MultiInstanceRelation {
-
-  override def producedAttributes: AttributeSet = outputSet
-
-  override lazy val resolved: Boolean = child.resolved
-
-  override def children: Seq[LogicalPlan] = child :: Nil
+    child: LogicalPlan) extends UnaryNode {
 
-  override def newInstance(): LogicalPlan = copy(output = 
output.map(_.newInstance()))
+  override def output: Seq[Attribute] = child.output
 
   override def simpleString(maxFields: Int): String = {
     s"View (${desc.identifier}, ${output.mkString("[", ",", "]")})"
   }
 
-  override def doCanonicalize(): LogicalPlan = {
-    def sameOutput(
-      outerProject: Seq[NamedExpression], innerProject: Seq[NamedExpression]): 
Boolean = {
-      outerProject.length == innerProject.length &&
-        outerProject.zip(innerProject).forall {
-          case(outer, inner) => outer.name == inner.name && outer.dataType == 
inner.dataType
-        }
-    }
-
-    val eliminated = EliminateView(this) match {
-      case Project(viewProjectList, child @ Project(queryProjectList, _))
-        if sameOutput(viewProjectList, queryProjectList) =>
-        child
-      case other => other
-    }
-    eliminated.canonicalized
-  }
+  override def doCanonicalize(): LogicalPlan = child.canonicalized

Review comment:
       @imback82 now the problem goes away.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to