Skip to content

Commit b198278

Browse files
committed
inherit ordering in project
1 parent c8e82a3 commit b198278

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/Exchange.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ import org.apache.spark.sql.catalyst.rules.Rule
2929
import org.apache.spark.util.MutablePair
3030

3131
/**
32-
* :: DeveloperApi ::
32+
* Shuffle data according to a new partition rule, and sort inside each partition if necessary.
33+
* @param newPartitioning The new partitioning way that required by parent
34+
* @param sort Whether we will sort inside each partition
35+
* @param child Child operator
3336
*/
3437
@DeveloperApi
3538
case class Exchange(

sql/core/src/main/scala/org/apache/spark/sql/execution/basicOperators.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,9 @@ case class Project(projectList: Seq[NamedExpression], child: SparkPlan) extends
4545
/**
4646
* outputOrdering of Project is not always same with child's outputOrdering if the certain
4747
* key is pruned, however, if the key is pruned then we must not require child using this
48-
* ordering from upper layer, only if the ordering would not be changed by a negative, there
49-
* would be a way to keep the ordering.
50-
* TODO: we may utilize this feature later to avoid some unnecessary sorting.
48+
* ordering from upper layer, so it is fine to keep it to avoid some unnecessary sorting.
5149
*/
52-
override def outputOrdering: Option[Ordering[Row]] = None
50+
override def outputOrdering: Option[Ordering[Row]] = child.outputOrdering
5351
}
5452

5553
/**

0 commit comments

Comments
 (0)