Ngone51 commented on a change in pull request #29166:
URL: https://github.com/apache/spark/pull/29166#discussion_r457918626



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -1192,11 +1192,23 @@ class Analyzer(
             if 
findAliases(projectList).intersect(conflictingAttributes).nonEmpty =>
           Seq((oldVersion, oldVersion.copy(projectList = 
newAliases(projectList))))
 
+        // We don't need to search child plan recursively if the projectList 
of a Project
+        // is only composed of Alias and doesn't contain any conflicting 
attributes.
+        // Because, even if the child plan has some conflicting attributes, 
the attributes
+        // will be aliased to non-conflicting attributes by the Project at the 
end.
+        case _ @ Project(projectList, _)
+          if findAliases(projectList).size == projectList.size =>
+          Nil

Review comment:
       I think we don't. It's mutually exclusive with the previous one as it 
has an implicit requirement ( 
`findAliases(projectList).intersect(conflictingAttributes).isEmpty`). 
Therefore, the actual requirement here is:
   `findAliases(projectList).intersect(conflictingAttributes).isEmpty && 
findAliases(projectList).size == projectList.size`




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