Github user marmbrus commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2345#discussion_r17452614
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
 ---
    @@ -47,6 +48,53 @@ object Optimizer extends RuleExecutor[LogicalPlan] {
     }
     
     /**
    +  *  Pushes operations to either side of a Union.
    +  */
    +object UnionPushdown extends Rule[LogicalPlan] {
    +
    +  /**
    +    *  Maps Attributes from the left side to the corresponding Attribute 
on the right side.
    +    */
    +  def buildRewrites(union: Union): AttributeMap[Attribute] = {
    +    assert(union.left.output.size == union.right.output.size)
    +
    +    AttributeMap(union.left.output.zip(union.right.output))
    +  }
    +
    +  /**
    +    *  Rewrites an expression so that it can be pushed to the right side 
of a Union operator.
    +    *  This method relies on the fact that the output attributes of a 
union are always equal
    +    *  to the left child's output.
    +    */
    +  def pushToRight[A <: Expression](e: A, union: Union, rewrites: 
AttributeMap[Attribute]): A = {
    --- End diff --
    
    Nit: `union` is not used.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to