Github user davies commented on the pull request:

    https://github.com/apache/spark/pull/11327#issuecomment-200959288
  
    @tgravescs The current change is good for your case, I'm thinking that 
maybe we could do better.
    
    The LocationIterator has a bad smell, it may call getPreferredLocs() many 
times on the same partition, which could be expensive as you mentioned, we 
should only call getPreferredLocs() on a partition once, by caching the result 
of it, or get rid of LocationIterator totally.
    
    Since we will call getPreferredLocs on every partition of previous RDD, we 
could eaglely call them in the beginning, partition all the partitions into two 
groups: with prefered location and without, do different things on them. This 
approach should solve all the cases that 1) all partition have locs 2) some 
partitions have locs 3) none of partiions have locs.
    
    Hopefully, this could be done in less than 10 seconds in your case.


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