You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by cloud-fan <gi...@git.apache.org> on 2018/04/04 07:05:25 UTC

[GitHub] spark pull request #20560: [SPARK-23375][SQL] Eliminate unneeded Sort in Opt...

Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20560#discussion_r179043661
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala ---
    @@ -733,6 +735,17 @@ object EliminateSorts extends Rule[LogicalPlan] {
       }
     }
     
    +/**
    + * Removes Sort operations on already sorted data
    + */
    +object RemoveRedundantSorts extends Rule[LogicalPlan] {
    +  def apply(plan: LogicalPlan): LogicalPlan = plan transform {
    +    case Sort(orders, true, child) if child.outputOrdering.nonEmpty
    +        && SortOrder.orderingSatisfies(child.outputOrdering, orders) =>
    --- End diff --
    
    shall we do it after planning as we already have `SparkPlan. outputOrdering`?


---

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