ulysses-you commented on a change in pull request #33222:
URL: https://github.com/apache/spark/pull/33222#discussion_r664216184
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/RemoveRedundantProjects.scala
##########
@@ -48,7 +48,7 @@ object RemoveRedundantProjects extends Rule[SparkPlan] {
private def removeProject(plan: SparkPlan, requireOrdering: Boolean):
SparkPlan = {
plan match {
case p @ ProjectExec(_, child) =>
- if (isRedundant(p, child, requireOrdering)) {
+ if (isRedundant(p, child, requireOrdering) && canRemove(p, child)) {
val newPlan = removeProject(child, requireOrdering)
newPlan.setLogicalLink(child.logicalLink.get)
Review comment:
how about use
`newPlan.setLogicalLink(child.logicalLink.get)` ->
`newPlan.setLogicalLink(p.logicalLink.get)` ?
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/RemoveRedundantProjects.scala
##########
@@ -48,9 +48,8 @@ object RemoveRedundantProjects extends Rule[SparkPlan] {
private def removeProject(plan: SparkPlan, requireOrdering: Boolean):
SparkPlan = {
plan match {
case p @ ProjectExec(_, child) =>
- if (isRedundant(p, child, requireOrdering)) {
+ if (isRedundant(p, child, requireOrdering) && canRemove(p, child)) {
val newPlan = removeProject(child, requireOrdering)
- newPlan.setLogicalLink(child.logicalLink.get)
newPlan
Review comment:
just `removeProject(child, requireOrdering)`
--
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]