Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/15041#discussion_r78273346
--- Diff: core/src/main/scala/org/apache/spark/util/collection/Utils.scala
---
@@ -30,10 +31,15 @@ private[spark] object Utils {
* Returns the first K elements from the input as defined by the
specified implicit Ordering[T]
* and maintains the ordering.
*/
- def takeOrdered[T](input: Iterator[T], num: Int)(implicit ord:
Ordering[T]): Iterator[T] = {
- val ordering = new GuavaOrdering[T] {
- override def compare(l: T, r: T): Int = ord.compare(l, r)
- }
- ordering.leastOf(input.asJava, num).iterator.asScala
+ def takeOrdered[T](input: Iterator[T], num: Int,
+ ser: Serializer = SparkEnv.get.serializer)(implicit ord:
Ordering[T]): Iterator[T] = {
+ val context = TaskContext.get()
--- End diff --
`context` could be null if task context is not set. Better to handle it.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]