Skip to content

Commit a9debe8

Browse files
srowenpwendell
authored andcommitted
SPARK-1344 [DOCS] Scala API docs for top methods
Use "k" in javadoc of top and takeOrdered to avoid confusion with type K in pair RDDs. I think this resolves the discussion in SPARK-1344. Author: Sean Owen <[email protected]> Closes #3168 from srowen/SPARK-1344 and squashes the following commits: 6963fcc [Sean Owen] Use "k" in javadoc of top and takeOrdered to avoid confusion with type K in pair RDDs (cherry picked from commit d136265) Signed-off-by: Patrick Wendell <[email protected]>
1 parent 6824af0 commit a9debe8

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

core/src/main/scala/org/apache/spark/api/java/JavaRDDLike.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -493,9 +493,9 @@ trait JavaRDDLike[T, This <: JavaRDDLike[T, This]] extends Serializable {
493493
}
494494

495495
/**
496-
* Returns the top K elements from this RDD as defined by
496+
* Returns the top k (largest) elements from this RDD as defined by
497497
* the specified Comparator[T].
498-
* @param num the number of top elements to return
498+
* @param num k, the number of top elements to return
499499
* @param comp the comparator that defines the order
500500
* @return an array of top elements
501501
*/
@@ -507,9 +507,9 @@ trait JavaRDDLike[T, This <: JavaRDDLike[T, This]] extends Serializable {
507507
}
508508

509509
/**
510-
* Returns the top K elements from this RDD using the
510+
* Returns the top k (largest) elements from this RDD using the
511511
* natural ordering for T.
512-
* @param num the number of top elements to return
512+
* @param num k, the number of top elements to return
513513
* @return an array of top elements
514514
*/
515515
def top(num: Int): JList[T] = {
@@ -518,9 +518,9 @@ trait JavaRDDLike[T, This <: JavaRDDLike[T, This]] extends Serializable {
518518
}
519519

520520
/**
521-
* Returns the first K elements from this RDD as defined by
521+
* Returns the first k (smallest) elements from this RDD as defined by
522522
* the specified Comparator[T] and maintains the order.
523-
* @param num the number of top elements to return
523+
* @param num k, the number of elements to return
524524
* @param comp the comparator that defines the order
525525
* @return an array of top elements
526526
*/
@@ -552,9 +552,9 @@ trait JavaRDDLike[T, This <: JavaRDDLike[T, This]] extends Serializable {
552552
}
553553

554554
/**
555-
* Returns the first K elements from this RDD using the
555+
* Returns the first k (smallest) elements from this RDD using the
556556
* natural ordering for T while maintain the order.
557-
* @param num the number of top elements to return
557+
* @param num k, the number of top elements to return
558558
* @return an array of top elements
559559
*/
560560
def takeOrdered(num: Int): JList[T] = {

core/src/main/scala/org/apache/spark/rdd/RDD.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ abstract class RDD[T: ClassTag](
10961096
}
10971097

10981098
/**
1099-
* Returns the top K (largest) elements from this RDD as defined by the specified
1099+
* Returns the top k (largest) elements from this RDD as defined by the specified
11001100
* implicit Ordering[T]. This does the opposite of [[takeOrdered]]. For example:
11011101
* {{{
11021102
* sc.parallelize(Seq(10, 4, 2, 12, 3)).top(1)
@@ -1106,14 +1106,14 @@ abstract class RDD[T: ClassTag](
11061106
* // returns Array(6, 5)
11071107
* }}}
11081108
*
1109-
* @param num the number of top elements to return
1109+
* @param num k, the number of top elements to return
11101110
* @param ord the implicit ordering for T
11111111
* @return an array of top elements
11121112
*/
11131113
def top(num: Int)(implicit ord: Ordering[T]): Array[T] = takeOrdered(num)(ord.reverse)
11141114

11151115
/**
1116-
* Returns the first K (smallest) elements from this RDD as defined by the specified
1116+
* Returns the first k (smallest) elements from this RDD as defined by the specified
11171117
* implicit Ordering[T] and maintains the ordering. This does the opposite of [[top]].
11181118
* For example:
11191119
* {{{
@@ -1124,7 +1124,7 @@ abstract class RDD[T: ClassTag](
11241124
* // returns Array(2, 3)
11251125
* }}}
11261126
*
1127-
* @param num the number of top elements to return
1127+
* @param num k, the number of elements to return
11281128
* @param ord the implicit ordering for T
11291129
* @return an array of top elements
11301130
*/

0 commit comments

Comments
 (0)