Github user mateiz commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1210#discussion_r15093402
  
    --- Diff: 
core/src/main/scala/org/apache/spark/rdd/OrderedRDDFunctions.scala ---
    @@ -57,14 +57,13 @@ class OrderedRDDFunctions[K : Ordering : ClassTag,
        */
       def sortByKey(ascending: Boolean = true, numPartitions: Int = 
self.partitions.size): RDD[P] = {
         val part = new RangePartitioner(numPartitions, self, ascending)
    -    val shuffled = new ShuffledRDD[K, V, V, P](self, 
part).setKeyOrdering(ordering)
    -    shuffled.mapPartitions(iter => {
    -      val buf = iter.toArray
    -      if (ascending) {
    -        buf.sortWith((x, y) => ordering.lt(x._1, y._1)).iterator
    -      } else {
    -        buf.sortWith((x, y) => ordering.gt(x._1, y._1)).iterator
    -      }
    -    }, preservesPartitioning = true)
    +    new ShuffledRDD[K, V, V, P](self, part)
    +      .setKeyOrdering(ordering)
    +      .setSortOrder(if (ascending) SortOrder.ASCENDING else 
SortOrder.DESCENDING)
       }
     }
    +
    +object SortOrder extends Enumeration {
    --- End diff --
    
    Actually probably `private[spark]` works for now


---
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.
---

Reply via email to