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

    https://github.com/apache/spark/pull/44#discussion_r10198205
  
    --- Diff: core/src/main/scala/org/apache/spark/SparkContext.scala ---
    @@ -950,6 +952,8 @@ class SparkContext(
           resultHandler: (Int, U) => Unit,
           resultFunc: => R): SimpleFutureAction[R] =
       {
    +    val rddPartitions = rdd.partitions.map(_.index)
    +    require(partitions.forall(rddPartitions.contains(_)), "partition index 
out of range")
    --- End diff --
    
    This check as written is going to have quadratic complexity. If you have 
100 partitions for example, you're going to create a list of length 100 at the 
top and then check for all 100 partitions whether they're in that list, getting 
10,000 operations. Can't you just check that all the indices in partitions are 
between 0 and rdd.partitions.size? I don't think RDDs can have non-contiguous 
partition numbers, though there might have been some stuff in the past with 
partition pruning that I may be misremembering.


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

Reply via email to