Skip to content

Commit 9b79246

Browse files
committed
Updated doc for Limit.
1 parent 47d3327 commit 9b79246

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,14 @@ case class Union(children: Seq[SparkPlan])(@transient sc: SparkContext) extends
6363
}
6464

6565
/**
66-
* Take the first limit elements.
66+
* Take the first limit elements. Note that the implementation is different depending on whether
67+
* this is a terminal operator or not. If it is terminal and is invoked using executeCollect,
68+
* this operator uses Spark's take method on the Spark driver. If it is not terminal or is
69+
* invoked using execute, we first take the limit on each partition, and then repartition all the
70+
* data to a single partition to compute the global limit.
6771
*/
6872
case class Limit(limit: Int, child: SparkPlan)(@transient sc: SparkContext) extends UnaryNode {
6973
override def otherCopyArgs = sc :: Nil
70-
// Note that the implementation is different depending on
71-
// whether this is a terminal operator or not.
7274

7375
override def output = child.output
7476

0 commit comments

Comments
 (0)