{"action":"created","comment":{"url":"https://api.github.com/repos/apache/beam/pulls/comments/181261877","pull_request_review_id":111848554,"id":181261877,"diff_hunk":"@@ -420,17 +313,38 @@ private long estimateSizeBytes() throws Exception {\n       }\n \n       try (Connection connection = ConnectionFactory.createConnection(read.getConfiguration())) {\n-        List<HRegionLocation> regionLocations = getRegionLocations(connection);\n-        int realNumSplits = numSplits < regionLocations.size() ? regionLocations.size() : numSplits;\n-        LOG.debug(\"Suggested {} bundle(s) based on size\", numSplits);\n-        LOG.debug(\"Suggested {} bundle(s) based on number of regions\", regionLocations.size());\n-        final List<HBaseSource> sources = splitBasedOnRegions(regionLocations, realNumSplits);\n-        LOG.debug(\"Split into {} bundle(s)\", sources.size());\n-        if (numSplits >= 1) {\n+        List<HRegionLocation> regionLocations =\n+            HBaseUtils.getRegionLocations(connection, read.tableId, read.serializableScan.get());\n+        LOG.debug(\"Suggested {} source(s) based on size\", numSplits);\n+        LOG.debug(\"Suggested {} source(s) based on number of regions\", regionLocations.size());\n+\n+        List<ByteKeyRange> ranges =\n+            HBaseUtils.getRanges(\n+                regionLocations, read.tableId, read.serializableScan.get());\n+        final int numSources = ranges.size();\n+        LOG.debug(\"Spliting into {} source(s)\", numSources);\n+        if (numSources >= 1) {","path":"sdks/java/io/hbase/src/main/java/org/apache/beam/sdk/io/hbase/HBaseIO.java","position":200,"original_position":200,"commit_id":"fd79ee9466e5a8297a0a0b543c8b4aba9e7a1ea0","original_commit_id":"fd79ee9466e5a8297a0a0b543c8b4aba9e7a1ea0","user":{"login":"tweise","id":263695,"avatar_url":"https://avatars1.githubusercontent.com/u/263695?v=4","gravatar_id":"","url":"https://api.github.com/users/tweise","html_url":"https://github.com/tweise","followers_url":"https://api.github.com/users/tweise/followers","following_url":"https://api.github.com/users/tweise/following{/other_user}","gists_url":"https://api.github.com/users/tweise/gists{/gist_id}","starred_url":"https://api.github.com/users/tweise/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tweise/subscriptions","organizations_url":"https://api.github.com/users/tweise/orgs","repos_url":"https://api.github.com/users/tweise/repos","events_url":"https://api.github.com/users/tweise/events{/privacy}","received_events_url":"https://api.github.com/users/tweise/received_events","type":"User","site_admin":false},"body":"`if numSources > 0` ?","created_at":"2018-04-13T00:57:43Z","updated_at":"2018-04-13T00:58:24Z","html_url":"https://github.com/apache/beam/pull/5081#discussion_r181261877","pull_request_url":"https://api.github.com/repos/apache/beam/pulls/5081","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/beam/pulls/comments/181261877"},"html":{"href":"https://github.com/apache/beam/pull/5081#discussion_r181261877"},"pull_request":{"href":"https://api.github.com/repos/apache/beam/pulls/5081"}}},"pull_request":{"url":"https://api.github.com/repos/apache/beam/pulls/5081","id":180610590,"html_url":"https://github.com/apache/beam/pull/5081","diff_url":"https://github.com/apache/beam/pull/5081.diff","patch_url":"https://github.com/apache/beam/pull/5081.patch","issue_url":"https://api.github.com/repos/apache/beam/issues/5081","number":5081,"state":"open","locked":false,"title":"[BEAM-4019] Refactor HBaseIO splitting to produce ByteKeyRange objects","user":{"login":"iemejia","id":79476,"avatar_url":"https://avatars3.githubusercontent.com/u/79476?v=4","gravatar_id":"","url":"https://api.github.com/users/iemejia","html_url":"https://github.com/iemejia","followers_url":"https://api.github.com/users/iemejia/followers","following_url":"https://api.github.com/users/iemejia/following{/other_user}","gists_url":"https://api.github.com/users/iemejia/gists{/gist_id}","starred_url":"https://api.github.com/users/iemejia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iemejia/subscriptions","organizations_url":"https://api.github.com/users/iemejia/orgs","repos_url":"https://api.github.com/users/iemejia/repos","events_url":"https://api.github.com/users/iemejia/events{/privacy}","received_events_url":"https://api.github.com/users/iemejia/received_events","type":"User","site_admin":false},"body":"For some context this is an internal refactor towards a SDF based translation of HBase read, it is just internals. I extracted most (if not all) HBase region/split related methods into an individual class `HBaseUtils` too. I did not create an additional unit test for that one since it is well covered by HBaseIOTest and I did not want to add additional extra time to the build..\r\n","created_at":"2018-04-10T13:55:08Z","updated_at":"2018-04-13T00:58:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5e8e1a72bd531c8bbb468ddfa0b5616e0c9b216a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/beam/pulls/5081/commits","review_comments_url":"https://api.github.com/repos/apache/beam/pulls/5081/comments","review_comment_url":"https://api.github.com/repos/apache/beam/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/beam/issues/5081/comments","statuses_url":"https://api.github.com/repos/apache/beam/statuses/fd79ee9466e5a8297a0a0b543c8b4aba9e7a1ea0","head":{"label":"iemejia:BEAM-4019-hbaseio-bytekeyrange-refactor","ref":"BEAM-4019-hbaseio-bytekeyrange-refactor","sha":"fd79ee9466e5a8297a0a0b543c8b4aba9e7a1ea0","user":{"login":"iemejia","id":79476,"avatar_url":"https://avatars3.githubusercontent.com/u/79476?v=4","gravatar_id":"","url":"https://api.github.com/users/iemejia","html_url":"https://github.com/iemejia","followers_url":"https://api.github.com/users/iemejia/followers","following_url":"https://api.github.com/users/iemejia/following{/other_user}","gists_url":"https://api.github.com/users/iemejia/gists{/gist_id}","starred_url":"https://api.github.com/users/iemejia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iemejia/subscriptions","organizations_url":"https://api.github.com/users/iemejia/orgs","repos_url":"https://api.github.com/users/iemejia/repos","events_url":"https://api.github.com/users/iemejia/events{/privacy}","received_events_url":"https://api.github.com/users/iemejia/received_events","type":"User","site_admin":false},"repo":{"id":58313008,"name":"beam","full_name":"iemejia/beam","owner":{"login":"iemejia","id":79476,"avatar_url":"https://avatars3.githubusercontent.com/u/79476?v=4","gravatar_id":"","url":"https://api.github.com/users/iemejia","html_url":"https://github.com/iemejia","followers_url":"https://api.github.com/users/iemejia/followers","following_url":"https://api.github.com/users/iemejia/following{/other_user}","gists_url":"https://api.github.com/users/iemejia/gists{/gist_id}","starred_url":"https://api.github.com/users/iemejia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iemejia/subscriptions","organizations_url":"https://api.github.com/users/iemejia/orgs","repos_url":"https://api.github.com/users/iemejia/repos","events_url":"https://api.github.com/users/iemejia/events{/privacy}","received_events_url":"https://api.github.com/users/iemejia/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/iemejia/beam","description":"Mirror of Apache Beam (Incubating)","fork":true,"url":"https://api.github.com/repos/iemejia/beam","forks_url":"https://api.github.com/repos/iemejia/beam/forks","keys_url":"https://api.github.com/repos/iemejia/beam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iemejia/beam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iemejia/beam/teams","hooks_url":"https://api.github.com/repos/iemejia/beam/hooks","issue_events_url":"https://api.github.com/repos/iemejia/beam/issues/events{/number}","events_url":"https://api.github.com/repos/iemejia/beam/events","assignees_url":"https://api.github.com/repos/iemejia/beam/assignees{/user}","branches_url":"https://api.github.com/repos/iemejia/beam/branches{/branch}","tags_url":"https://api.github.com/repos/iemejia/beam/tags","blobs_url":"https://api.github.com/repos/iemejia/beam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iemejia/beam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iemejia/beam/git/refs{/sha}","trees_url":"https://api.github.com/repos/iemejia/beam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iemejia/beam/statuses/{sha}","languages_url":"https://api.github.com/repos/iemejia/beam/languages","stargazers_url":"https://api.github.com/repos/iemejia/beam/stargazers","contributors_url":"https://api.github.com/repos/iemejia/beam/contributors","subscribers_url":"https://api.github.com/repos/iemejia/beam/subscribers","subscription_url":"https://api.github.com/repos/iemejia/beam/subscription","commits_url":"https://api.github.com/repos/iemejia/beam/commits{/sha}","git_commits_url":"https://api.github.com/repos/iemejia/beam/git/commits{/sha}","comments_url":"https://api.github.com/repos/iemejia/beam/comments{/number}","issue_comment_url":"https://api.github.com/repos/iemejia/beam/issues/comments{/number}","contents_url":"https://api.github.com/repos/iemejia/beam/contents/{+path}","compare_url":"https://api.github.com/repos/iemejia/beam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iemejia/beam/merges","archive_url":"https://api.github.com/repos/iemejia/beam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iemejia/beam/downloads","issues_url":"https://api.github.com/repos/iemejia/beam/issues{/number}","pulls_url":"https://api.github.com/repos/iemejia/beam/pulls{/number}","milestones_url":"https://api.github.com/repos/iemejia/beam/milestones{/number}","notifications_url":"https://api.github.com/repos/iemejia/beam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iemejia/beam/labels{/name}","releases_url":"https://api.github.com/repos/iemejia/beam/releases{/id}","deployments_url":"https://api.github.com/repos/iemejia/beam/deployments","created_at":"2016-05-08T13:21:00Z","updated_at":"2017-03-14T16:18:21Z","pushed_at":"2018-04-10T22:01:37Z","git_url":"git://github.com/iemejia/beam.git","ssh_url":"git@github.com:iemejia/beam.git","clone_url":"https://github.com/iemejia/beam.git","svn_url":"https://github.com/iemejia/beam","homepage":null,"size":55717,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":1,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"200eec699f254daba4ce586d1a60716aaede7b5e","user":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","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":50904245,"name":"beam","full_name":"apache/beam","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","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/beam","description":"Apache Beam","fork":false,"url":"https://api.github.com/repos/apache/beam","forks_url":"https://api.github.com/repos/apache/beam/forks","keys_url":"https://api.github.com/repos/apache/beam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/beam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/beam/teams","hooks_url":"https://api.github.com/repos/apache/beam/hooks","issue_events_url":"https://api.github.com/repos/apache/beam/issues/events{/number}","events_url":"https://api.github.com/repos/apache/beam/events","assignees_url":"https://api.github.com/repos/apache/beam/assignees{/user}","branches_url":"https://api.github.com/repos/apache/beam/branches{/branch}","tags_url":"https://api.github.com/repos/apache/beam/tags","blobs_url":"https://api.github.com/repos/apache/beam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/beam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/beam/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/beam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/beam/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/beam/languages","stargazers_url":"https://api.github.com/repos/apache/beam/stargazers","contributors_url":"https://api.github.com/repos/apache/beam/contributors","subscribers_url":"https://api.github.com/repos/apache/beam/subscribers","subscription_url":"https://api.github.com/repos/apache/beam/subscription","commits_url":"https://api.github.com/repos/apache/beam/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/beam/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/beam/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/beam/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/beam/contents/{+path}","compare_url":"https://api.github.com/repos/apache/beam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/beam/merges","archive_url":"https://api.github.com/repos/apache/beam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/beam/downloads","issues_url":"https://api.github.com/repos/apache/beam/issues{/number}","pulls_url":"https://api.github.com/repos/apache/beam/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/beam/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/beam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/beam/labels{/name}","releases_url":"https://api.github.com/repos/apache/beam/releases{/id}","deployments_url":"https://api.github.com/repos/apache/beam/deployments","created_at":"2016-02-02T08:00:06Z","updated_at":"2018-04-13T00:41:43Z","pushed_at":"2018-04-13T00:48:09Z","git_url":"git://github.com/apache/beam.git","ssh_url":"git@github.com:apache/beam.git","clone_url":"https://github.com/apache/beam.git","svn_url":"https://github.com/apache/beam","homepage":"","size":56661,"stargazers_count":1812,"watchers_count":1812,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1098,"mirror_url":null,"archived":false,"open_issues_count":120,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":1098,"open_issues":120,"watchers":1812,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/beam/pulls/5081"},"html":{"href":"https://github.com/apache/beam/pull/5081"},"issue":{"href":"https://api.github.com/repos/apache/beam/issues/5081"},"comments":{"href":"https://api.github.com/repos/apache/beam/issues/5081/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/beam/pulls/5081/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/beam/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/beam/pulls/5081/commits"},"statuses":{"href":"https://api.github.com/repos/apache/beam/statuses/fd79ee9466e5a8297a0a0b543c8b4aba9e7a1ea0"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"tweise"}}