Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions core/src/main/scala/org/apache/spark/api/java/JavaRDDLike.scala
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,9 @@ trait JavaRDDLike[T, This <: JavaRDDLike[T, This]] extends Serializable {
}

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

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

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

/**
* Returns the first K elements from this RDD using the
* Returns the first k (smallest) elements from this RDD using the
* natural ordering for T while maintain the order.
* @param num the number of top elements to return
* @param num k, the number of top elements to return
* @return an array of top elements
*/
def takeOrdered(num: Int): JList[T] = {
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/scala/org/apache/spark/rdd/RDD.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ abstract class RDD[T: ClassTag](
}

/**
* Returns the top K (largest) elements from this RDD as defined by the specified
* 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(Seq(10, 4, 2, 12, 3)).top(1)
Expand All @@ -1106,14 +1106,14 @@ abstract class RDD[T: ClassTag](
* // returns Array(6, 5)
* }}}
*
* @param num the number of top elements to return
* @param num k, the number of top elements to return
* @param ord the implicit ordering for T
* @return an array of top elements
*/
def top(num: Int)(implicit ord: Ordering[T]): Array[T] = takeOrdered(num)(ord.reverse)

/**
* Returns the first K (smallest) elements from this RDD as defined by the specified
* Returns the first k (smallest) elements from this RDD as defined by the specified
* implicit Ordering[T] and maintains the ordering. This does the opposite of [[top]].
* For example:
* {{{
Expand All @@ -1124,7 +1124,7 @@ abstract class RDD[T: ClassTag](
* // returns Array(2, 3)
* }}}
*
* @param num the number of top elements to return
* @param num k, the number of elements to return
* @param ord the implicit ordering for T
* @return an array of top elements
*/
Expand Down