Skip to content

Commit ac32723

Browse files
author
Eric Liang
committed
make limit/takeOrdered output SinglePartition
1 parent 4bba10c commit ac32723

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import org.apache.spark.sql.SQLContext
2727
import org.apache.spark.sql.catalyst.ScalaReflection
2828
import org.apache.spark.sql.catalyst.errors._
2929
import org.apache.spark.sql.catalyst.expressions._
30-
import org.apache.spark.sql.catalyst.plans.physical.{ClusteredDistribution, OrderedDistribution, UnspecifiedDistribution}
30+
import org.apache.spark.sql.catalyst.plans.physical.{ClusteredDistribution, OrderedDistribution, SinglePartition, UnspecifiedDistribution}
3131
import org.apache.spark.util.MutablePair
3232

3333
/**
@@ -97,6 +97,7 @@ case class Limit(limit: Int, child: SparkPlan)
9797
// partition local limit -> exchange into one partition -> partition local limit again
9898

9999
override def output = child.output
100+
override def outputPartitioning = SinglePartition
100101

101102
/**
102103
* A custom implementation modeled after the take function on RDDs but which never runs any job
@@ -164,6 +165,7 @@ case class Limit(limit: Int, child: SparkPlan)
164165
case class TakeOrdered(limit: Int, sortOrder: Seq[SortOrder], child: SparkPlan) extends UnaryNode {
165166

166167
override def output = child.output
168+
override def outputPartitioning = SinglePartition
167169

168170
val ordering = new RowOrdering(sortOrder, child.output)
169171

0 commit comments

Comments
 (0)