Ngone51 commented on a change in pull request #29166:
URL: https://github.com/apache/spark/pull/29166#discussion_r457914954
##########
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
+
case oldVersion @ Aggregate(_, aggregateExpressions, _)
if
findAliases(aggregateExpressions).intersect(conflictingAttributes).nonEmpty =>
Seq((oldVersion, oldVersion.copy(
aggregateExpressions = newAliases(aggregateExpressions))))
+ case _ @ Aggregate(_, aggregateExpressions, _)
Review comment:
Yes, sure.
----------------------------------------------------------------
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]