diff options
author | seanm <sean.mcnamara@webtrends.com> | 2013-07-11 18:55:00 -0700 |
---|---|---|
committer | seanm <sean.mcnamara@webtrends.com> | 2013-07-11 18:55:00 -0700 |
commit | a2c915fba84a1deadac199994322e0f15d5750b4 (patch) | |
tree | a8d4911efc2dd9c1b5f1f751973dde9461d09544 /core/src/main | |
parent | ee4ce2fc51112387f28d7b422969ca2e9736e95f (diff) | |
download | spark-a2c915fba84a1deadac199994322e0f15d5750b4.tar.gz spark-a2c915fba84a1deadac199994322e0f15d5750b4.tar.bz2 spark-a2c915fba84a1deadac199994322e0f15d5750b4.zip |
giving order to top and making tests more clear
Diffstat (limited to 'core/src/main')
-rw-r--r-- | core/src/main/scala/spark/RDD.scala | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/core/src/main/scala/spark/RDD.scala b/core/src/main/scala/spark/RDD.scala index af52040fa6..4c1591ed5a 100644 --- a/core/src/main/scala/spark/RDD.scala +++ b/core/src/main/scala/spark/RDD.scala @@ -778,7 +778,7 @@ abstract class RDD[T: ClassManifest]( }.reduce { (queue1, queue2) => queue1 ++= queue2 queue1 - }.toArray + }.toArray.sorted(ord.reverse) } /** @@ -789,9 +789,7 @@ abstract class RDD[T: ClassManifest]( * @param ord the implicit ordering for T * @return an array of top elements */ - def takeOrdered(num: Int)(implicit ord: Ordering[T]): Array[T] = { - top(num)(ord.reverse).sorted(ord) - } + def takeOrdered(num: Int)(implicit ord: Ordering[T]): Array[T] = top(num)(ord.reverse) /** * Save this RDD as a text file, using string representations of elements. |