cloud-fan commented on a change in pull request #35214:
URL: https://github.com/apache/spark/pull/35214#discussion_r786415710
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
##########
@@ -762,22 +762,22 @@ object PushProjectionThroughUnion extends
Rule[LogicalPlan] with PredicateHelper
result.asInstanceOf[A]
}
+ def pushProjectionThroughUnion(projectList: Seq[NamedExpression], u: Union):
Seq[LogicalPlan] = {
+ val newFirstChild = Project(projectList, u.children.head)
+ val newOtherChildren = u.children.tail.map { child =>
+ val rewrites = buildRewrites(u.children.head, child)
+ Project(projectList.map(pushToRight(_, rewrites)), child)
+ }
+ newFirstChild +: newOtherChildren
+ }
+
def apply(plan: LogicalPlan): LogicalPlan = plan.transformWithPruning(
_.containsAllPatterns(UNION, PROJECT)) {
// Push down deterministic projection through UNION ALL
- case p @ Project(projectList, u: Union) =>
Review comment:
unnecessary change?
--
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]