cloud-fan commented on code in PR #41347:
URL: https://github.com/apache/spark/pull/41347#discussion_r1256454196


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/DeduplicateRelations.scala:
##########
@@ -105,6 +105,21 @@ object DeduplicateRelations extends Rule[LogicalPlan] {
         (m, false)
       }
 
+    case p @ Project(_, child) if p.resolved && 
p.projectList.forall(_.isInstanceOf[Alias]) =>
+      val (renewed, changed) = renewDuplicatedRelations(existingRelations, 
child)
+      val (newPlan, planChanged) = 
getNewPlanWithNewChildren(existingRelations, Array(renewed),
+        p, changed)
+      var newProject = newPlan.asInstanceOf[Project]
+      val planWrapper = RelationWrapper(p.getClass, 
newProject.projectList.map(_.exprId.id))

Review Comment:
   `Project` is a common node and let's not always create the `RelationWrapper` 
here.
   
   We can find the new attributes precisely from `Project`:
   ```
   projectList.collect {
     case a: Alias => a.exprId.id
   }
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

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