File tree Expand file tree Collapse file tree 5 files changed +11
-11
lines changed
catalyst/src/main/scala/org/apache/spark/sql/catalyst
core/src/main/scala/org/apache/spark/sql/execution Expand file tree Collapse file tree 5 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -740,8 +740,8 @@ object EliminateSorts extends Rule[LogicalPlan] {
740
740
*/
741
741
object RemoveRedundantSorts extends Rule [LogicalPlan ] {
742
742
def apply (plan : LogicalPlan ): LogicalPlan = plan transform {
743
- case Sort (orders, true , child) if child.sortedOrder .nonEmpty
744
- && child.sortedOrder.zip(orders).forall { case (s1, s2) => s1.satisfies(s2) } =>
743
+ case Sort (orders, true , child) if child.outputOrdering .nonEmpty
744
+ && SortOrder .orderingSatisfies(child.outputOrdering, orders) =>
745
745
child
746
746
}
747
747
}
Original file line number Diff line number Diff line change @@ -221,9 +221,9 @@ abstract class LogicalPlan
221
221
def refresh (): Unit = children.foreach(_.refresh())
222
222
223
223
/**
224
- * If the current plan contains sorted data, it contains the sorted order .
224
+ * Returns the output ordering that this plan generates .
225
225
*/
226
- def sortedOrder : Seq [SortOrder ] = Nil
226
+ def outputOrdering : Seq [SortOrder ] = Nil
227
227
}
228
228
229
229
/**
@@ -281,5 +281,5 @@ abstract class BinaryNode extends LogicalPlan {
281
281
}
282
282
283
283
abstract class KeepOrderUnaryNode extends UnaryNode {
284
- override final def sortedOrder : Seq [SortOrder ] = child.sortedOrder
284
+ override final def outputOrdering : Seq [SortOrder ] = child.outputOrdering
285
285
}
Original file line number Diff line number Diff line change @@ -470,7 +470,7 @@ case class Sort(
470
470
child : LogicalPlan ) extends UnaryNode {
471
471
override def output : Seq [Attribute ] = child.output
472
472
override def maxRows : Option [Long ] = child.maxRows
473
- override def sortedOrder : Seq [SortOrder ] = order
473
+ override def outputOrdering : Seq [SortOrder ] = order
474
474
}
475
475
476
476
/** Factory for constructing new `Range` nodes. */
@@ -525,7 +525,7 @@ case class Range(
525
525
Statistics (sizeInBytes = LongType .defaultSize * numElements)
526
526
}
527
527
528
- override def sortedOrder : Seq [SortOrder ] = output.map(a => SortOrder (a, Descending ))
528
+ override def outputOrdering : Seq [SortOrder ] = output.map(a => SortOrder (a, Descending ))
529
529
}
530
530
531
531
case class Aggregate (
@@ -872,8 +872,8 @@ case class RepartitionByExpression(
872
872
override def maxRows : Option [Long ] = child.maxRows
873
873
override def shuffle : Boolean = true
874
874
875
- override def sortedOrder : Seq [SortOrder ] = partitioning match {
876
- case RangePartitioning (sortedOrder , _) => sortedOrder
875
+ override def outputOrdering : Seq [SortOrder ] = partitioning match {
876
+ case RangePartitioning (ordering , _) => ordering
877
877
case _ => Nil
878
878
}
879
879
}
Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ case class LogicalRDD(
125
125
output : Seq [Attribute ],
126
126
rdd : RDD [InternalRow ],
127
127
outputPartitioning : Partitioning = UnknownPartitioning (0 ),
128
- outputOrdering : Seq [SortOrder ] = Nil ,
128
+ override val outputOrdering : Seq [SortOrder ] = Nil ,
129
129
override val isStreaming : Boolean = false )(session : SparkSession )
130
130
extends LeafNode with MultiInstanceRelation {
131
131
Original file line number Diff line number Diff line change @@ -170,5 +170,5 @@ case class InMemoryRelation(
170
170
override protected def otherCopyArgs : Seq [AnyRef ] =
171
171
Seq (_cachedColumnBuffers, sizeInBytesStats, statsOfPlanToCache)
172
172
173
- override def sortedOrder : Seq [SortOrder ] = child.outputOrdering
173
+ override def outputOrdering : Seq [SortOrder ] = child.outputOrdering
174
174
}
You can’t perform that action at this time.
0 commit comments