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

    https://github.com/apache/spark/pull/11327#discussion_r54375032
  
    --- Diff: core/src/main/scala/org/apache/spark/rdd/CoalescedRDD.scala ---
    @@ -192,7 +192,8 @@ private class PartitionCoalescer(maxPartitions: Int, 
prev: RDD[_], balanceSlack:
         def resetIterator(): Iterator[(String, Partition)] = {
           val iterators = (0 to 2).map( x =>
             prev.partitions.iterator.flatMap(p => {
    -          if (currPrefLocs(p).size > x) Some((currPrefLocs(p)(x), p)) else 
None
    +          val locs = currPrefLocs(p)
    +          if (locs.size > x) Some((locs(x), p)) else None
    --- End diff --
    
    It's not size vs length. It's seq.size can sometimes be O(n).
    
    For size vs length, we should use length if it is a string or an array, but 
size if it is a collection.



---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to