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

    https://github.com/apache/spark/pull/16933#discussion_r101341551
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
 ---
    @@ -563,23 +563,27 @@ object CollapseProject extends Rule[LogicalPlan] {
     /**
      * Combines adjacent [[Repartition]] and [[RepartitionByExpression]] 
operator combinations
      * by keeping only the one.
    - * 1. For adjacent [[Repartition]]s, collapse into the last 
[[Repartition]].
    + * 1. For adjacent [[Repartition]]s, collapse into the last 
[[Repartition]] if their shuffle types
    + *    are the same or the parent's shuffle is true.
      * 2. For adjacent [[RepartitionByExpression]]s, collapse into the last 
[[RepartitionByExpression]].
    - * 3. For a combination of [[Repartition]] and 
[[RepartitionByExpression]], collapse as a single
    - *    [[RepartitionByExpression]] with the expression and last number of 
partition.
    + * 3. When a shuffle-enabled [[Repartition]] is above a 
[[RepartitionByExpression]], collapse as a
    + *    single [[RepartitionByExpression]] with the expression and the last 
number of partition.
    + * 4. When a [[RepartitionByExpression]] is above a [[Repartition]], 
collapse as a single
    --- End diff --
    
    `RepartitionByExpression ` always uses `ShuffleExchange`. Thus, it is like 
Repartition with enabled shuffle. 


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