Github user windpiger commented on a diff in the pull request:
https://github.com/apache/spark/pull/16255#discussion_r92311295
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
---
@@ -416,8 +418,8 @@ object ColumnPruning extends Rule[LogicalPlan] {
case w: Window if w.windowExpressions.isEmpty => w.child
// Eliminate no-op Projects
- case p @ Project(_, child) if sameOutput(child.output, p.output) =>
child
-
+ case p @ Project(_, child) if sameOutput(child.output, p.output) =>
+ if (child.isInstanceOf[CatalogRelation]) p else child
--- End diff --
yes, it will transform the right side of the join, and the problem happened
when replace the right side of the join. Above step 5, it apply
RemoveAliasOnlyProject rule on step 4's plan, which replace col#6 with col#9,
but it does not have effect on `Project [col#9 AS col#6]` of the right side of
the join. I think the right side `Project [col#9 AS col#6]` should be changed
to `Project [col#9]`
```
Project [col#9 AS c1#4, col#10 AS c2#5]
+- Join Cross
:- Join Cross
: :- Project
: : +- MetastoreRelation default, p1
: +- MetastoreRelation default, p2
+- !Project [col#9 AS col#10]
+- Join Cross
:- Project
: +- MetastoreRelation default, p1
+- Project [col#9 AS col#6]
+- MetastoreRelation default, p2
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]