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

    https://github.com/apache/spark/pull/11828#discussion_r56720500
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
 ---
    @@ -305,21 +306,14 @@ object SetOperationPushDown extends Rule[LogicalPlan] 
with PredicateHelper {
     }
     
     /**
    - * Attempts to eliminate the reading of unneeded columns from the query 
plan using the following
    - * transformations:
    - *
    - *  - Inserting Projections beneath the following operators:
    - *   - Aggregate
    - *   - Generate
    - *   - Project <- Join
    - *   - LeftSemiJoin
    + * Attempts to eliminate the reading of unneeded columns from the query 
plan.
      */
     object ColumnPruning extends Rule[LogicalPlan] {
       private def sameOutput(output1: Seq[Attribute], output2: 
Seq[Attribute]): Boolean =
         output1.size == output2.size &&
           output1.zip(output2).forall(pair => pair._1.semanticEquals(pair._2))
     
    -  def apply(plan: LogicalPlan): LogicalPlan = plan transform {
    +  def apply(plan: LogicalPlan): LogicalPlan = 
removeProjectBeforeFilter(plan transform {
    --- End diff --
    
    Here, we are using `transform`, which is actually `transformDown`. In this 
rule `ColumnPruning`, we could add many `Project` into the child. This could 
easily cause stack overflow. That is why my PR 
https://github.com/apache/spark/pull/11745 is changing it to `transformUp`. Do 
you think this change makes sense?


---
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]

Reply via email to