dongjoon-hyun commented on a change in pull request #24082:
[SPARK-27123][SQL][FOLLOWUP] Use isRenaming check for limit too.
URL: https://github.com/apache/spark/pull/24082#discussion_r265223386
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
##########
@@ -699,20 +703,13 @@ object CollapseProject extends Rule[LogicalPlan] {
agg.copy(aggregateExpressions = buildCleanedProjectList(
p.projectList, agg.aggregateExpressions))
}
- case p1 @ Project(_, g @ GlobalLimit(_, l @ LocalLimit(_, p2: Project))) =>
- if (haveCommonNonDeterministicOutput(p1.projectList, p2.projectList)) {
- p1
- } else {
- val newProjectList = buildCleanedProjectList(p1.projectList,
p2.projectList)
- g.copy(child = l.copy(child = p2.copy(projectList = newProjectList)))
- }
- case p1 @ Project(_, l @ LocalLimit(_, p2: Project)) =>
- if (haveCommonNonDeterministicOutput(p1.projectList, p2.projectList)) {
- p1
- } else {
- val newProjectList = buildCleanedProjectList(p1.projectList,
p2.projectList)
- l.copy(child = p2.copy(projectList = newProjectList))
- }
+ case Project(l1, g @ GlobalLimit(_, limit @ LocalLimit(_, p2 @ Project(l2,
_))))
Review comment:
If there is `Alias`, It wasn't. That is the point of my previous PR.
Please see `IsRenaming` logic here. This considers that case, too.
-
https://github.com/apache/spark/pull/24082/files#diff-a636a87d8843eeccca90140be91d4fafL764
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]