{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/44435230","id":44435230,"diff_hunk":"@@ -193,6 +254,12 @@ private[spark] object HighlyCompressedMapStatus {\n     } else {\n       0\n     }\n-    new HighlyCompressedMapStatus(loc, numNonEmptyBlocks, emptyBlocks, avgSize)\n+    if(numNonEmptyBlocks * 32 < totalNumBlocks){\n+      MapStatusTrackingEmptyBlocks(loc, numNonEmptyBlocks, nonEmptyBlocks, avgSize, isSparse = true)\n+    } else if ((totalNumBlocks - numNonEmptyBlocks) * 32 < totalNumBlocks){\n+      MapStatusTrackingEmptyBlocks(loc, numNonEmptyBlocks, emptyBlocksHashSet, avgSize, isSparse = false)","path":"core/src/main/scala/org/apache/spark/scheduler/MapStatus.scala","position":118,"original_position":118,"commit_id":"e6fb687069d47fdb7c55485bf7e97f33dbcab370","original_commit_id":"e6fb687069d47fdb7c55485bf7e97f33dbcab370","user":{"login":"squito","id":71240,"avatar_url":"https://avatars.githubusercontent.com/u/71240?v=3","gravatar_id":"","url":"https://api.github.com/users/squito","html_url":"https://github.com/squito","followers_url":"https://api.github.com/users/squito/followers","following_url":"https://api.github.com/users/squito/following{/other_user}","gists_url":"https://api.github.com/users/squito/gists{/gist_id}","starred_url":"https://api.github.com/users/squito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/squito/subscriptions","organizations_url":"https://api.github.com/users/squito/orgs","repos_url":"https://api.github.com/users/squito/repos","events_url":"https://api.github.com/users/squito/events{/privacy}","received_events_url":"https://api.github.com/users/squito/received_events","type":"User","site_admin":false},"body":"`isSparse` is the wrong name, I think -- both cases are sparse, its a question of whether or not you are storing the empty blocks.","created_at":"2015-11-10T17:17:38Z","updated_at":"2015-11-10T17:17:38Z","html_url":"https://github.com/apache/spark/pull/9559#discussion_r44435230","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/9559","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/44435230"},"html":{"href":"https://github.com/apache/spark/pull/9559#discussion_r44435230"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/9559"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/9559","id":50089336,"html_url":"https://github.com/apache/spark/pull/9559","diff_url":"https://github.com/apache/spark/pull/9559.diff","patch_url":"https://github.com/apache/spark/pull/9559.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/9559","number":9559,"state":"open","locked":false,"title":"[SPARK-11583][Scheduler][Core] Make MapStatus use less memory uage","user":{"login":"yaooqinn","id":8326978,"avatar_url":"https://avatars.githubusercontent.com/u/8326978?v=3","gravatar_id":"","url":"https://api.github.com/users/yaooqinn","html_url":"https://github.com/yaooqinn","followers_url":"https://api.github.com/users/yaooqinn/followers","following_url":"https://api.github.com/users/yaooqinn/following{/other_user}","gists_url":"https://api.github.com/users/yaooqinn/gists{/gist_id}","starred_url":"https://api.github.com/users/yaooqinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yaooqinn/subscriptions","organizations_url":"https://api.github.com/users/yaooqinn/orgs","repos_url":"https://api.github.com/users/yaooqinn/repos","events_url":"https://api.github.com/users/yaooqinn/events{/privacy}","received_events_url":"https://api.github.com/users/yaooqinn/received_events","type":"User","site_admin":false},"body":"Disscuss about this pr is at https://issues.apache.org/jira/browse/SPARK-11583\r\n\r\nIn the resolved issue https://issues.apache.org/jira/browse/SPARK-11271, as I said, using BitSet can save ≈20% memory usage compared to RoaringBitMap.\r\nFor a spark job contains quite a lot of tasks, 20% seems a drop in the ocean.\r\nEssentially, BitSet uses long[]. For example a BitSet[200k] = long[3125].\r\nSo if we use a HashSet[Int] to store reduceId (when non-empty blocks are dense,use reduceId of empty blocks; when sparse, use non-empty ones).\r\nFor dense cases: if HashSet[Int](numNonEmptyBlocks).size < BitSet[totalBlockNum], I use MapStatusTrackingNoEmptyBlocks\r\nFor sparse cases: if HashSet[Int](numEmptyBlocks).size < BitSet[totalBlockNum], I use MapStatusTrackingEmptyBlocks\r\nsparse case, 299/300 are empty\r\nsc.makeRDD(1 to 30000, 3000).groupBy(x=>x).top(5)\r\ndense case, no block is empty\r\nsc.makeRDD(1 to 9000000, 3000).groupBy(x=>x).top(5)","created_at":"2015-11-09T06:37:09Z","updated_at":"2015-11-10T17:17:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"56c06a8d9d2c2679f868383907c065595919a9d0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/9559/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/9559/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/9559/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/e6fb687069d47fdb7c55485bf7e97f33dbcab370","head":{"label":"yaooqinn:mapstatus-smaller","ref":"mapstatus-smaller","sha":"e6fb687069d47fdb7c55485bf7e97f33dbcab370","user":{"login":"yaooqinn","id":8326978,"avatar_url":"https://avatars.githubusercontent.com/u/8326978?v=3","gravatar_id":"","url":"https://api.github.com/users/yaooqinn","html_url":"https://github.com/yaooqinn","followers_url":"https://api.github.com/users/yaooqinn/followers","following_url":"https://api.github.com/users/yaooqinn/following{/other_user}","gists_url":"https://api.github.com/users/yaooqinn/gists{/gist_id}","starred_url":"https://api.github.com/users/yaooqinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yaooqinn/subscriptions","organizations_url":"https://api.github.com/users/yaooqinn/orgs","repos_url":"https://api.github.com/users/yaooqinn/repos","events_url":"https://api.github.com/users/yaooqinn/events{/privacy}","received_events_url":"https://api.github.com/users/yaooqinn/received_events","type":"User","site_admin":false},"repo":{"id":45728081,"name":"spark","full_name":"yaooqinn/spark","owner":{"login":"yaooqinn","id":8326978,"avatar_url":"https://avatars.githubusercontent.com/u/8326978?v=3","gravatar_id":"","url":"https://api.github.com/users/yaooqinn","html_url":"https://github.com/yaooqinn","followers_url":"https://api.github.com/users/yaooqinn/followers","following_url":"https://api.github.com/users/yaooqinn/following{/other_user}","gists_url":"https://api.github.com/users/yaooqinn/gists{/gist_id}","starred_url":"https://api.github.com/users/yaooqinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yaooqinn/subscriptions","organizations_url":"https://api.github.com/users/yaooqinn/orgs","repos_url":"https://api.github.com/users/yaooqinn/repos","events_url":"https://api.github.com/users/yaooqinn/events{/privacy}","received_events_url":"https://api.github.com/users/yaooqinn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yaooqinn/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/yaooqinn/spark","forks_url":"https://api.github.com/repos/yaooqinn/spark/forks","keys_url":"https://api.github.com/repos/yaooqinn/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yaooqinn/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yaooqinn/spark/teams","hooks_url":"https://api.github.com/repos/yaooqinn/spark/hooks","issue_events_url":"https://api.github.com/repos/yaooqinn/spark/issues/events{/number}","events_url":"https://api.github.com/repos/yaooqinn/spark/events","assignees_url":"https://api.github.com/repos/yaooqinn/spark/assignees{/user}","branches_url":"https://api.github.com/repos/yaooqinn/spark/branches{/branch}","tags_url":"https://api.github.com/repos/yaooqinn/spark/tags","blobs_url":"https://api.github.com/repos/yaooqinn/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yaooqinn/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yaooqinn/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/yaooqinn/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yaooqinn/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/yaooqinn/spark/languages","stargazers_url":"https://api.github.com/repos/yaooqinn/spark/stargazers","contributors_url":"https://api.github.com/repos/yaooqinn/spark/contributors","subscribers_url":"https://api.github.com/repos/yaooqinn/spark/subscribers","subscription_url":"https://api.github.com/repos/yaooqinn/spark/subscription","commits_url":"https://api.github.com/repos/yaooqinn/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/yaooqinn/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/yaooqinn/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/yaooqinn/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/yaooqinn/spark/contents/{+path}","compare_url":"https://api.github.com/repos/yaooqinn/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yaooqinn/spark/merges","archive_url":"https://api.github.com/repos/yaooqinn/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yaooqinn/spark/downloads","issues_url":"https://api.github.com/repos/yaooqinn/spark/issues{/number}","pulls_url":"https://api.github.com/repos/yaooqinn/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/yaooqinn/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/yaooqinn/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yaooqinn/spark/labels{/name}","releases_url":"https://api.github.com/repos/yaooqinn/spark/releases{/id}","created_at":"2015-11-07T08:12:20Z","updated_at":"2015-11-07T08:12:51Z","pushed_at":"2015-11-10T09:11:54Z","git_url":"git://github.com/yaooqinn/spark.git","ssh_url":"git@github.com:yaooqinn/spark.git","clone_url":"https://github.com/yaooqinn/spark.git","svn_url":"https://github.com/yaooqinn/spark","homepage":null,"size":130776,"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":"521b3cae118d1e22c170e2aad43f9baa162db55e","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}","created_at":"2014-02-25T08:00:08Z","updated_at":"2015-11-10T15:56:26Z","pushed_at":"2015-11-10T15:33:50Z","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":1656965,"stargazers_count":6115,"watchers_count":6115,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5663,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":378,"forks":5663,"open_issues":378,"watchers":6115,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/9559"},"html":{"href":"https://github.com/apache/spark/pull/9559"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/9559"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/9559/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/9559/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/9559/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/e6fb687069d47fdb7c55485bf7e97f33dbcab370"}}}}