File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
sql/core/src/main/scala/org/apache/spark/sql/execution Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -174,12 +174,14 @@ private[sql] case class AddExchange(sqlContext: SQLContext) extends Rule[SparkPl
174174 def addExchangeIfNecessary (
175175 partitioning : Partitioning ,
176176 child : SparkPlan ,
177- rowOrdering : Option [Ordering [Row ]] = None ): SparkPlan =
178- if (child.outputPartitioning != partitioning) {
179- Exchange (partitioning, child, sort = child.outputOrdering != rowOrdering)
177+ rowOrdering : Option [Ordering [Row ]] = None ): SparkPlan = {
178+ val needSort = child.outputOrdering != rowOrdering
179+ if (child.outputPartitioning != partitioning || needSort) {
180+ Exchange (partitioning, child, sort = needSort)
180181 } else {
181182 child
182183 }
184+ }
183185
184186 if (meetsRequirements && compatible) {
185187 operator
You can’t perform that action at this time.
0 commit comments