{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/56747153","id":56747153,"diff_hunk":"@@ -62,7 +64,23 @@ class UnionRDD[T: ClassTag](\n     var rdds: Seq[RDD[T]])\n   extends RDD[T](sc, Nil) {  // Nil since we implement getDependencies\n \n+  // Evaluate partitions in parallel. Partitions of each rdd will be cached by the `partitions`\n+  // val in `RDD`.\n+  private[spark] lazy val parallelPartitionEval: Boolean = {\n+    val threshold = conf.getInt(\"spark.rdd.parallelListingThreshold\", 10)\n+    if (threshold > 0 && rdds.length > threshold) {\n+      val parArray = rdds.toParArray\n+      parArray.tasksupport = new ForkJoinTaskSupport(\n+        new ForkJoinPool(math.min(threshold, 8)))","path":"core/src/main/scala/org/apache/spark/rdd/UnionRDD.scala","position":20,"original_position":20,"commit_id":"79d618efd299eda148acfd998f86a32c80d43929","original_commit_id":"79d618efd299eda148acfd998f86a32c80d43929","user":{"login":"dbtsai","id":1134574,"avatar_url":"https://avatars.githubusercontent.com/u/1134574?v=3","gravatar_id":"","url":"https://api.github.com/users/dbtsai","html_url":"https://github.com/dbtsai","followers_url":"https://api.github.com/users/dbtsai/followers","following_url":"https://api.github.com/users/dbtsai/following{/other_user}","gists_url":"https://api.github.com/users/dbtsai/gists{/gist_id}","starred_url":"https://api.github.com/users/dbtsai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbtsai/subscriptions","organizations_url":"https://api.github.com/users/dbtsai/orgs","repos_url":"https://api.github.com/users/dbtsai/repos","events_url":"https://api.github.com/users/dbtsai/events{/privacy}","received_events_url":"https://api.github.com/users/dbtsai/received_events","type":"User","site_admin":false},"body":"Sounds fair. ","created_at":"2016-03-19T10:04:43Z","updated_at":"2016-03-19T10:04:43Z","html_url":"https://github.com/apache/spark/pull/11242#discussion_r56747153","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/11242","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/56747153"},"html":{"href":"https://github.com/apache/spark/pull/11242#discussion_r56747153"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/11242"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/11242","id":59710270,"html_url":"https://github.com/apache/spark/pull/11242","diff_url":"https://github.com/apache/spark/pull/11242.diff","patch_url":"https://github.com/apache/spark/pull/11242.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/11242","number":11242,"state":"open","locked":false,"title":"SPARK-9926: Parallelize partition logic in UnionRDD.","user":{"login":"rdblue","id":87915,"avatar_url":"https://avatars.githubusercontent.com/u/87915?v=3","gravatar_id":"","url":"https://api.github.com/users/rdblue","html_url":"https://github.com/rdblue","followers_url":"https://api.github.com/users/rdblue/followers","following_url":"https://api.github.com/users/rdblue/following{/other_user}","gists_url":"https://api.github.com/users/rdblue/gists{/gist_id}","starred_url":"https://api.github.com/users/rdblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdblue/subscriptions","organizations_url":"https://api.github.com/users/rdblue/orgs","repos_url":"https://api.github.com/users/rdblue/repos","events_url":"https://api.github.com/users/rdblue/events{/privacy}","received_events_url":"https://api.github.com/users/rdblue/received_events","type":"User","site_admin":false},"body":"This patch has the new logic from #8512 that uses a parallel collection to compute partitions in UnionRDD. The rest of #8512 added an alternative code path for calculating splits in S3, but that isn't necessary to get the same speedup. The underlying problem wasn't that bulk listing wasn't used, it was that an extra FileStatus was retrieved for each file. The fix was just committed as [HADOOP-12810](https://issues.apache.org/jira/browse/HADOOP-12810). (I think the original commit also used a single prefix to enumerate all paths, but that isn't always helpful and it was removed in later versions so there is no need for SparkS3Utils.)\r\n\r\nI tested this using the same table that @piapiaozhexiu was using. Calculating splits for a 10-day period took 25 seconds with this change and HADOOP-12810, which is on par with the results from #8512.","created_at":"2016-02-17T21:18:04Z","updated_at":"2016-03-19T10:04:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"972d443944fb7bff7dade16a8926d5ac4fbd3d1d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/11242/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/11242/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/11242/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/79d618efd299eda148acfd998f86a32c80d43929","head":{"label":"rdblue:SPARK-9926-parallelize-union-rdd","ref":"SPARK-9926-parallelize-union-rdd","sha":"79d618efd299eda148acfd998f86a32c80d43929","user":{"login":"rdblue","id":87915,"avatar_url":"https://avatars.githubusercontent.com/u/87915?v=3","gravatar_id":"","url":"https://api.github.com/users/rdblue","html_url":"https://github.com/rdblue","followers_url":"https://api.github.com/users/rdblue/followers","following_url":"https://api.github.com/users/rdblue/following{/other_user}","gists_url":"https://api.github.com/users/rdblue/gists{/gist_id}","starred_url":"https://api.github.com/users/rdblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdblue/subscriptions","organizations_url":"https://api.github.com/users/rdblue/orgs","repos_url":"https://api.github.com/users/rdblue/repos","events_url":"https://api.github.com/users/rdblue/events{/privacy}","received_events_url":"https://api.github.com/users/rdblue/received_events","type":"User","site_admin":false},"repo":{"id":26284539,"name":"spark","full_name":"rdblue/spark","owner":{"login":"rdblue","id":87915,"avatar_url":"https://avatars.githubusercontent.com/u/87915?v=3","gravatar_id":"","url":"https://api.github.com/users/rdblue","html_url":"https://github.com/rdblue","followers_url":"https://api.github.com/users/rdblue/followers","following_url":"https://api.github.com/users/rdblue/following{/other_user}","gists_url":"https://api.github.com/users/rdblue/gists{/gist_id}","starred_url":"https://api.github.com/users/rdblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdblue/subscriptions","organizations_url":"https://api.github.com/users/rdblue/orgs","repos_url":"https://api.github.com/users/rdblue/repos","events_url":"https://api.github.com/users/rdblue/events{/privacy}","received_events_url":"https://api.github.com/users/rdblue/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rdblue/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/rdblue/spark","forks_url":"https://api.github.com/repos/rdblue/spark/forks","keys_url":"https://api.github.com/repos/rdblue/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rdblue/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rdblue/spark/teams","hooks_url":"https://api.github.com/repos/rdblue/spark/hooks","issue_events_url":"https://api.github.com/repos/rdblue/spark/issues/events{/number}","events_url":"https://api.github.com/repos/rdblue/spark/events","assignees_url":"https://api.github.com/repos/rdblue/spark/assignees{/user}","branches_url":"https://api.github.com/repos/rdblue/spark/branches{/branch}","tags_url":"https://api.github.com/repos/rdblue/spark/tags","blobs_url":"https://api.github.com/repos/rdblue/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rdblue/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rdblue/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/rdblue/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rdblue/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/rdblue/spark/languages","stargazers_url":"https://api.github.com/repos/rdblue/spark/stargazers","contributors_url":"https://api.github.com/repos/rdblue/spark/contributors","subscribers_url":"https://api.github.com/repos/rdblue/spark/subscribers","subscription_url":"https://api.github.com/repos/rdblue/spark/subscription","commits_url":"https://api.github.com/repos/rdblue/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/rdblue/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/rdblue/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/rdblue/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/rdblue/spark/contents/{+path}","compare_url":"https://api.github.com/repos/rdblue/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rdblue/spark/merges","archive_url":"https://api.github.com/repos/rdblue/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rdblue/spark/downloads","issues_url":"https://api.github.com/repos/rdblue/spark/issues{/number}","pulls_url":"https://api.github.com/repos/rdblue/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/rdblue/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/rdblue/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rdblue/spark/labels{/name}","releases_url":"https://api.github.com/repos/rdblue/spark/releases{/id}","deployments_url":"https://api.github.com/repos/rdblue/spark/deployments","created_at":"2014-11-06T18:50:45Z","updated_at":"2016-02-10T17:46:05Z","pushed_at":"2016-03-17T20:02:01Z","git_url":"git://github.com/rdblue/spark.git","ssh_url":"git@github.com:rdblue/spark.git","clone_url":"https://github.com/rdblue/spark.git","svn_url":"https://github.com/rdblue/spark","homepage":null,"size":145847,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"4c08e2c0850cda03aa930445652c03881594b4ce","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":17165658,"name":"spark","full_name":"apache/spark","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/spark","description":"Mirror of Apache Spark","fork":false,"url":"https://api.github.com/repos/apache/spark","forks_url":"https://api.github.com/repos/apache/spark/forks","keys_url":"https://api.github.com/repos/apache/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/spark/teams","hooks_url":"https://api.github.com/repos/apache/spark/hooks","issue_events_url":"https://api.github.com/repos/apache/spark/issues/events{/number}","events_url":"https://api.github.com/repos/apache/spark/events","assignees_url":"https://api.github.com/repos/apache/spark/assignees{/user}","branches_url":"https://api.github.com/repos/apache/spark/branches{/branch}","tags_url":"https://api.github.com/repos/apache/spark/tags","blobs_url":"https://api.github.com/repos/apache/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/spark/languages","stargazers_url":"https://api.github.com/repos/apache/spark/stargazers","contributors_url":"https://api.github.com/repos/apache/spark/contributors","subscribers_url":"https://api.github.com/repos/apache/spark/subscribers","subscription_url":"https://api.github.com/repos/apache/spark/subscription","commits_url":"https://api.github.com/repos/apache/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/spark/contents/{+path}","compare_url":"https://api.github.com/repos/apache/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/spark/merges","archive_url":"https://api.github.com/repos/apache/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/spark/downloads","issues_url":"https://api.github.com/repos/apache/spark/issues{/number}","pulls_url":"https://api.github.com/repos/apache/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/spark/labels{/name}","releases_url":"https://api.github.com/repos/apache/spark/releases{/id}","deployments_url":"https://api.github.com/repos/apache/spark/deployments","created_at":"2014-02-25T08:00:08Z","updated_at":"2016-03-19T06:47:14Z","pushed_at":"2016-03-19T09:16:03Z","git_url":"git://github.com/apache/spark.git","ssh_url":"git@github.com:apache/spark.git","clone_url":"https://github.com/apache/spark.git","svn_url":"https://github.com/apache/spark","homepage":null,"size":444522,"stargazers_count":7844,"watchers_count":7844,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7208,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":406,"forks":7208,"open_issues":406,"watchers":7844,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/11242"},"html":{"href":"https://github.com/apache/spark/pull/11242"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/11242"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/11242/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/11242/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/11242/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/79d618efd299eda148acfd998f86a32c80d43929"}}}}