Github user JoshRosen commented on the pull request:

    https://github.com/apache/spark/pull/1381#issuecomment-55509179
  
    Personal style preference, but I think this is a slightly clearer way to 
express the calculation of the partition indices:
    
    ```diff
    diff --git 
a/core/src/main/scala/org/apache/spark/rdd/OrderedRDDFunctions.scala 
b/core/src/main/scala/org/apache/spark/rdd/OrderedRDDFunctions.scala
    index 7889269..87f6db3 100644
    --- a/core/src/main/scala/org/apache/spark/rdd/OrderedRDDFunctions.scala
    +++ b/core/src/main/scala/org/apache/spark/rdd/OrderedRDDFunctions.scala
    @@ -87,10 +87,9 @@ class OrderedRDDFunctions[K : Ordering : ClassTag,
         def inRange(k: K): Boolean = ordering.gteq(k, lower) && 
ordering.lteq(k, upper)
    
         val rddToFilter: RDD[P] = self.partitioner match {
    -      case Some(rp: RangePartitioner[K,V]) => {
    +      case Some(rp: RangePartitioner[K, V]) => {
             val partitionIndicies = (rp.getPartition(lower), 
rp.getPartition(upper)) match {
    -          case (l, u) if l <= u => l to u
    -          case (l, u) if l > u => u to l
    +          case (l, u) => Math.min(l, u) to Math.max(l, u)
             }
             PartitionPruningRDD.create(self, partitionIndicies.contains)
           }
    ```


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

Reply via email to