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

    https://github.com/apache/spark/pull/18861#discussion_r131809065
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
 ---
    @@ -596,14 +596,15 @@ object CollapseProject extends Rule[LogicalPlan] {
     object CollapseRepartition extends Rule[LogicalPlan] {
       def apply(plan: LogicalPlan): LogicalPlan = plan transformUp {
         // Case 1: When a Repartition has a child of Repartition or 
RepartitionByExpression,
    -    // 1) When the top node does not enable the shuffle (i.e., coalesce 
API), but the child
    -    //   enables the shuffle. Returns the child node if the last 
numPartitions is bigger;
    -    //   otherwise, keep unchanged.
    +    // 1) When the top node does not enable the shuffle (i.e., coalesce 
with no user-specified
    +    //   strategy), but the child enables the shuffle. Returns the child 
node if the last
    +    //   numPartitions is bigger; otherwise, keep unchanged.
         // 2) In the other cases, returns the top node with the child's child
    -    case r @ Repartition(_, _, child: RepartitionOperation) => (r.shuffle, 
child.shuffle) match {
    -      case (false, true) => if (r.numPartitions >= child.numPartitions) 
child else r
    -      case _ => r.copy(child = child.child)
    -    }
    +    case r @ Repartition(_, _, child: RepartitionOperation, None) =>
    --- End diff --
    
    sorry, my bad. Fixed.


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