You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/12/20 08:40:18 UTC
[GitHub] [spark] cloud-fan commented on a change in pull request #33946: [SPARK-36703][SQL] Remove the Sort if it is the child of RepartitionByExpression
cloud-fan commented on a change in pull request #33946:
URL: https://github.com/apache/spark/pull/33946#discussion_r772171364
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
##########
@@ -987,10 +987,10 @@ object CollapseRepartition extends Rule[LogicalPlan] {
case (false, true) => if (r.numPartitions >= child.numPartitions) child else r
case _ => r.copy(child = child.child)
}
- // Case 2: When a RepartitionByExpression has a child of Repartition or RepartitionByExpression
- // we can remove the child.
- case r @ RepartitionByExpression(_, child: RepartitionOperation, _) =>
- r.copy(child = child.child)
+ // Case 2: When a RepartitionByExpression has a child of Sort, Repartition or
+ // RepartitionByExpression we can remove the child.
+ case r @ RepartitionByExpression(_, child @ (_: Sort | _: RepartitionOperation), _) =>
Review comment:
is it possible that Spark can keep the ordering in some cases?
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org