-
- Downloads
[SPARK-21401][ML][MLLIB] add poll function for BoundedPriorityQueue
## What changes were proposed in this pull request? The most of BoundedPriorityQueue usages in ML/MLLIB are: Get the value of BoundedPriorityQueue, then sort it. For example, in Word2Vec: pq.toSeq.sortBy(-_._2) in ALS, pq.toArray.sorted() The test results show using pq.poll is much faster than sort the value. It is good to add the poll function for BoundedPriorityQueue. ## How was this patch tested? The existing UT Author: Peng <peng.meng@intel.com> Author: Peng Meng <peng.meng@intel.com> Closes #18620 from mpjlu/add-poll.
Showing
- core/src/main/scala/org/apache/spark/util/BoundedPriorityQueue.scala 4 additions, 0 deletions...in/scala/org/apache/spark/util/BoundedPriorityQueue.scala
- core/src/test/scala/org/apache/spark/util/BoundedPriorityQueueSuite.scala 51 additions, 0 deletions...ala/org/apache/spark/util/BoundedPriorityQueueSuite.scala
Please register or sign in to comment