Skip to content

Commit

Permalink
SPARK-2146. Fix takeOrdered doc
Browse files Browse the repository at this point in the history
Removes Python syntax in Scaladoc, corrects result in Scaladoc, and removes irrelevant cache() call in Python doc.

Author: Sandy Ryza <[email protected]>

Closes apache#1086 from sryza/sandy-spark-2146 and squashes the following commits:

185ff18 [Sandy Ryza] Use Seq instead of Array
c996120 [Sandy Ryza] SPARK-2146.  Fix takeOrdered doc
  • Loading branch information
sryza authored and pwendell committed Jun 17, 2014
1 parent b92d16b commit 2794990
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions core/src/main/scala/org/apache/spark/rdd/RDD.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1074,11 +1074,11 @@ abstract class RDD[T: ClassTag](
* Returns the top K (largest) elements from this RDD as defined by the specified
* implicit Ordering[T]. This does the opposite of [[takeOrdered]]. For example:
* {{{
* sc.parallelize([10, 4, 2, 12, 3]).top(1)
* // returns [12]
* sc.parallelize(Seq(10, 4, 2, 12, 3)).top(1)
* // returns Array(12)
*
* sc.parallelize([2, 3, 4, 5, 6]).top(2)
* // returns [6, 5]
* sc.parallelize(Seq(2, 3, 4, 5, 6)).top(2)
* // returns Array(6, 5)
* }}}
*
* @param num the number of top elements to return
Expand All @@ -1092,11 +1092,11 @@ abstract class RDD[T: ClassTag](
* implicit Ordering[T] and maintains the ordering. This does the opposite of [[top]].
* For example:
* {{{
* sc.parallelize([10, 4, 2, 12, 3]).takeOrdered(1)
* // returns [12]
* sc.parallelize(Seq(10, 4, 2, 12, 3)).takeOrdered(1)
* // returns Array(2)
*
* sc.parallelize([2, 3, 4, 5, 6]).takeOrdered(2)
* // returns [2, 3]
* sc.parallelize(Seq(2, 3, 4, 5, 6)).takeOrdered(2)
* // returns Array(2, 3)
* }}}
*
* @param num the number of top elements to return
Expand Down
2 changes: 1 addition & 1 deletion python/pyspark/rdd.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ def top(self, num):
Note: It returns the list sorted in descending order.
>>> sc.parallelize([10, 4, 2, 12, 3]).top(1)
[12]
>>> sc.parallelize([2, 3, 4, 5, 6], 2).cache().top(2)
>>> sc.parallelize([2, 3, 4, 5, 6], 2).top(2)
[6, 5]
"""
def topIterator(iterator):
Expand Down

0 comments on commit 2794990

Please sign in to comment.