{"action":"created","comment":{"url":"https://api.github.com/repos/linkedin/pinot/pulls/comments/195187014","pull_request_review_id":128504287,"id":195187014,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NTE4NzAxNA==","diff_hunk":"@@ -60,196 +56,151 @@\n  * </ul>\n  */\n public final class OffHeapBitmapInvertedIndexCreator implements InvertedIndexCreator {\n-  // Maximum number of values due to 2GB file size limit\n-  public static final int MAX_NUM_VALUES = Integer.MAX_VALUE / V1Constants.Numbers.INTEGER_SIZE;\n-\n-  private final String _columnName;\n+  private final File _invertedIndexFile;\n   private final boolean _singleValue;\n   private final int _cardinality;\n   private final int _numDocs;\n   private final int _numValues;\n-  private final File _indexDir;\n-  private final File _invertedIndexFile;\n \n-  private ByteBuffer _valueByteBuffer;\n-  private IntBuffer _valueIntBuffer;\n-\n-  // For multi-value column only\n-  private int _valueBufferOffset;\n-  private ByteBuffer _numValuesByteBuffer;\n-  private IntBuffer _numValuesIntBuffer;\n-\n-  // Posting list related buffers\n-  // Constructed in first pass\n-  private ByteBuffer _postingListLengthByteBuffer;\n-  private IntBuffer _postingListLengthIntBuffer;\n-  // Constructed in second pass\n-  private ByteBuffer _postingListValueByteBuffer;\n-  private ByteBuffer _postingListCurrentOffsetByteBuffer;\n+  // For single-valued and multi-valued column\n+  private int _nextDocId;\n+  private LBuffer _valueBuffer;\n+  private LBuffer _postingListIndexBuffer;\n+  private LBuffer _postingListValueBuffer;\n+  // For multi-valued column only\n+  private int _nextValueId;\n+  private LBuffer _numValuesBuffer;\n \n   public OffHeapBitmapInvertedIndexCreator(File indexDir, FieldSpec fieldSpec, int cardinality, int numDocs,\n       int numValues) {\n-    _columnName = fieldSpec.getName();\n+    _invertedIndexFile =\n+        new File(indexDir, fieldSpec.getName() + V1Constants.Indexes.BITMAP_INVERTED_INDEX_FILE_EXTENSION);\n     _singleValue = fieldSpec.isSingleValueField();\n     _cardinality = cardinality;\n     _numDocs = numDocs;\n-    if (_singleValue) {\n-      Preconditions.checkArgument(numDocs <= MAX_NUM_VALUES,\n-          \"For single-value column: %s, numDocs: %s is too large to create inverted index\", _columnName, numDocs);\n-      _numValues = numDocs;\n-    } else {\n-      Preconditions.checkArgument(numValues <= MAX_NUM_VALUES,\n-          \"For multi-value column: %s, numValues: %s is too large to create inverted index\", _columnName, numValues);\n-      _numValues = numValues;\n-    }\n-    _indexDir = indexDir;\n-    _invertedIndexFile = new File(indexDir, _columnName + V1Constants.Indexes.BITMAP_INVERTED_INDEX_FILE_EXTENSION);\n+    _numValues = _singleValue ? numDocs : numValues;\n \n     try {\n-      // Create value buffer\n-      _valueByteBuffer = MmapUtils.allocateDirectByteBuffer(_numValues * V1Constants.Numbers.INTEGER_SIZE, null,\n-          \"bitmap value buffer for: \" + _columnName);\n-      _valueIntBuffer = _valueByteBuffer.asIntBuffer();\n-\n-      // Create numValues buffer for multi-value column\n+      _valueBuffer = new LBuffer((long) _numValues * Integer.BYTES);\n+      _postingListIndexBuffer = new LBuffer((long) _cardinality * Integer.BYTES);\n+      _postingListIndexBuffer.clear();","path":"pinot-core/src/main/java/com/linkedin/pinot/core/segment/creator/impl/inv/OffHeapBitmapInvertedIndexCreator.java","position":115,"original_position":115,"commit_id":"87d9d6a03e72f227f8fa135e316c48347362001f","original_commit_id":"87d9d6a03e72f227f8fa135e316c48347362001f","user":{"login":"Jackie-Jiang","id":17555551,"node_id":"MDQ6VXNlcjE3NTU1NTUx","avatar_url":"https://avatars3.githubusercontent.com/u/17555551?v=4","gravatar_id":"","url":"https://api.github.com/users/Jackie-Jiang","html_url":"https://github.com/Jackie-Jiang","followers_url":"https://api.github.com/users/Jackie-Jiang/followers","following_url":"https://api.github.com/users/Jackie-Jiang/following{/other_user}","gists_url":"https://api.github.com/users/Jackie-Jiang/gists{/gist_id}","starred_url":"https://api.github.com/users/Jackie-Jiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jackie-Jiang/subscriptions","organizations_url":"https://api.github.com/users/Jackie-Jiang/orgs","repos_url":"https://api.github.com/users/Jackie-Jiang/repos","events_url":"https://api.github.com/users/Jackie-Jiang/events{/privacy}","received_events_url":"https://api.github.com/users/Jackie-Jiang/received_events","type":"User","site_admin":false},"body":"Because for _postingListIndexBuffer we rely on the initial value 0, and we keep adding to that value","created_at":"2018-06-13T18:19:01Z","updated_at":"2018-06-13T18:19:02Z","html_url":"https://github.com/linkedin/pinot/pull/2886#discussion_r195187014","pull_request_url":"https://api.github.com/repos/linkedin/pinot/pulls/2886","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/linkedin/pinot/pulls/comments/195187014"},"html":{"href":"https://github.com/linkedin/pinot/pull/2886#discussion_r195187014"},"pull_request":{"href":"https://api.github.com/repos/linkedin/pinot/pulls/2886"}},"in_reply_to_id":195109404},"pull_request":{"url":"https://api.github.com/repos/linkedin/pinot/pulls/2886","id":194477991,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk0NDc3OTkx","html_url":"https://github.com/linkedin/pinot/pull/2886","diff_url":"https://github.com/linkedin/pinot/pull/2886.diff","patch_url":"https://github.com/linkedin/pinot/pull/2886.patch","issue_url":"https://api.github.com/repos/linkedin/pinot/issues/2886","number":2886,"state":"open","locked":false,"title":"Re-implement OffHeapBitmapInvertedIndexCreator to support large number of values (> 500M)","user":{"login":"Jackie-Jiang","id":17555551,"node_id":"MDQ6VXNlcjE3NTU1NTUx","avatar_url":"https://avatars3.githubusercontent.com/u/17555551?v=4","gravatar_id":"","url":"https://api.github.com/users/Jackie-Jiang","html_url":"https://github.com/Jackie-Jiang","followers_url":"https://api.github.com/users/Jackie-Jiang/followers","following_url":"https://api.github.com/users/Jackie-Jiang/following{/other_user}","gists_url":"https://api.github.com/users/Jackie-Jiang/gists{/gist_id}","starred_url":"https://api.github.com/users/Jackie-Jiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jackie-Jiang/subscriptions","organizations_url":"https://api.github.com/users/Jackie-Jiang/orgs","repos_url":"https://api.github.com/users/Jackie-Jiang/repos","events_url":"https://api.github.com/users/Jackie-Jiang/events{/privacy}","received_events_url":"https://api.github.com/users/Jackie-Jiang/received_events","type":"User","site_admin":false},"body":"1. Use LBuffer instead of ByteBuffer to allocate direct memory buffer larger than 2G\n2. Re-use buffer if possible to reduce memory footprint\n3. Do not generate extra temporary file during index generation","created_at":"2018-06-13T05:57:12Z","updated_at":"2018-06-13T18:19:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"147753c03e6c1f6f531f4c61e9023b4db56e7011","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/linkedin/pinot/pulls/2886/commits","review_comments_url":"https://api.github.com/repos/linkedin/pinot/pulls/2886/comments","review_comment_url":"https://api.github.com/repos/linkedin/pinot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/linkedin/pinot/issues/2886/comments","statuses_url":"https://api.github.com/repos/linkedin/pinot/statuses/87d9d6a03e72f227f8fa135e316c48347362001f","head":{"label":"linkedin:offheap_inverted_index","ref":"offheap_inverted_index","sha":"87d9d6a03e72f227f8fa135e316c48347362001f","user":{"login":"linkedin","id":357098,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NzA5OA==","avatar_url":"https://avatars3.githubusercontent.com/u/357098?v=4","gravatar_id":"","url":"https://api.github.com/users/linkedin","html_url":"https://github.com/linkedin","followers_url":"https://api.github.com/users/linkedin/followers","following_url":"https://api.github.com/users/linkedin/following{/other_user}","gists_url":"https://api.github.com/users/linkedin/gists{/gist_id}","starred_url":"https://api.github.com/users/linkedin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linkedin/subscriptions","organizations_url":"https://api.github.com/users/linkedin/orgs","repos_url":"https://api.github.com/users/linkedin/repos","events_url":"https://api.github.com/users/linkedin/events{/privacy}","received_events_url":"https://api.github.com/users/linkedin/received_events","type":"Organization","site_admin":false},"repo":{"id":19961085,"node_id":"MDEwOlJlcG9zaXRvcnkxOTk2MTA4NQ==","name":"pinot","full_name":"linkedin/pinot","owner":{"login":"linkedin","id":357098,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NzA5OA==","avatar_url":"https://avatars3.githubusercontent.com/u/357098?v=4","gravatar_id":"","url":"https://api.github.com/users/linkedin","html_url":"https://github.com/linkedin","followers_url":"https://api.github.com/users/linkedin/followers","following_url":"https://api.github.com/users/linkedin/following{/other_user}","gists_url":"https://api.github.com/users/linkedin/gists{/gist_id}","starred_url":"https://api.github.com/users/linkedin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linkedin/subscriptions","organizations_url":"https://api.github.com/users/linkedin/orgs","repos_url":"https://api.github.com/users/linkedin/repos","events_url":"https://api.github.com/users/linkedin/events{/privacy}","received_events_url":"https://api.github.com/users/linkedin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/linkedin/pinot","description":"A realtime distributed OLAP datastore","fork":false,"url":"https://api.github.com/repos/linkedin/pinot","forks_url":"https://api.github.com/repos/linkedin/pinot/forks","keys_url":"https://api.github.com/repos/linkedin/pinot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/linkedin/pinot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/linkedin/pinot/teams","hooks_url":"https://api.github.com/repos/linkedin/pinot/hooks","issue_events_url":"https://api.github.com/repos/linkedin/pinot/issues/events{/number}","events_url":"https://api.github.com/repos/linkedin/pinot/events","assignees_url":"https://api.github.com/repos/linkedin/pinot/assignees{/user}","branches_url":"https://api.github.com/repos/linkedin/pinot/branches{/branch}","tags_url":"https://api.github.com/repos/linkedin/pinot/tags","blobs_url":"https://api.github.com/repos/linkedin/pinot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/linkedin/pinot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/linkedin/pinot/git/refs{/sha}","trees_url":"https://api.github.com/repos/linkedin/pinot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/linkedin/pinot/statuses/{sha}","languages_url":"https://api.github.com/repos/linkedin/pinot/languages","stargazers_url":"https://api.github.com/repos/linkedin/pinot/stargazers","contributors_url":"https://api.github.com/repos/linkedin/pinot/contributors","subscribers_url":"https://api.github.com/repos/linkedin/pinot/subscribers","subscription_url":"https://api.github.com/repos/linkedin/pinot/subscription","commits_url":"https://api.github.com/repos/linkedin/pinot/commits{/sha}","git_commits_url":"https://api.github.com/repos/linkedin/pinot/git/commits{/sha}","comments_url":"https://api.github.com/repos/linkedin/pinot/comments{/number}","issue_comment_url":"https://api.github.com/repos/linkedin/pinot/issues/comments{/number}","contents_url":"https://api.github.com/repos/linkedin/pinot/contents/{+path}","compare_url":"https://api.github.com/repos/linkedin/pinot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/linkedin/pinot/merges","archive_url":"https://api.github.com/repos/linkedin/pinot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/linkedin/pinot/downloads","issues_url":"https://api.github.com/repos/linkedin/pinot/issues{/number}","pulls_url":"https://api.github.com/repos/linkedin/pinot/pulls{/number}","milestones_url":"https://api.github.com/repos/linkedin/pinot/milestones{/number}","notifications_url":"https://api.github.com/repos/linkedin/pinot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/linkedin/pinot/labels{/name}","releases_url":"https://api.github.com/repos/linkedin/pinot/releases{/id}","deployments_url":"https://api.github.com/repos/linkedin/pinot/deployments","created_at":"2014-05-19T23:27:48Z","updated_at":"2018-06-13T17:43:56Z","pushed_at":"2018-06-13T17:43:42Z","git_url":"git://github.com/linkedin/pinot.git","ssh_url":"git@github.com:linkedin/pinot.git","clone_url":"https://github.com/linkedin/pinot.git","svn_url":"https://github.com/linkedin/pinot","homepage":"https://github.com/linkedin/pinot/wiki","size":152183,"stargazers_count":1864,"watchers_count":1864,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":339,"mirror_url":null,"archived":false,"open_issues_count":167,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":339,"open_issues":167,"watchers":1864,"default_branch":"master"}},"base":{"label":"linkedin:master","ref":"master","sha":"03852e10514254b655c994d8ed68403ed40e2d1b","user":{"login":"linkedin","id":357098,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NzA5OA==","avatar_url":"https://avatars3.githubusercontent.com/u/357098?v=4","gravatar_id":"","url":"https://api.github.com/users/linkedin","html_url":"https://github.com/linkedin","followers_url":"https://api.github.com/users/linkedin/followers","following_url":"https://api.github.com/users/linkedin/following{/other_user}","gists_url":"https://api.github.com/users/linkedin/gists{/gist_id}","starred_url":"https://api.github.com/users/linkedin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linkedin/subscriptions","organizations_url":"https://api.github.com/users/linkedin/orgs","repos_url":"https://api.github.com/users/linkedin/repos","events_url":"https://api.github.com/users/linkedin/events{/privacy}","received_events_url":"https://api.github.com/users/linkedin/received_events","type":"Organization","site_admin":false},"repo":{"id":19961085,"node_id":"MDEwOlJlcG9zaXRvcnkxOTk2MTA4NQ==","name":"pinot","full_name":"linkedin/pinot","owner":{"login":"linkedin","id":357098,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1NzA5OA==","avatar_url":"https://avatars3.githubusercontent.com/u/357098?v=4","gravatar_id":"","url":"https://api.github.com/users/linkedin","html_url":"https://github.com/linkedin","followers_url":"https://api.github.com/users/linkedin/followers","following_url":"https://api.github.com/users/linkedin/following{/other_user}","gists_url":"https://api.github.com/users/linkedin/gists{/gist_id}","starred_url":"https://api.github.com/users/linkedin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linkedin/subscriptions","organizations_url":"https://api.github.com/users/linkedin/orgs","repos_url":"https://api.github.com/users/linkedin/repos","events_url":"https://api.github.com/users/linkedin/events{/privacy}","received_events_url":"https://api.github.com/users/linkedin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/linkedin/pinot","description":"A realtime distributed OLAP datastore","fork":false,"url":"https://api.github.com/repos/linkedin/pinot","forks_url":"https://api.github.com/repos/linkedin/pinot/forks","keys_url":"https://api.github.com/repos/linkedin/pinot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/linkedin/pinot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/linkedin/pinot/teams","hooks_url":"https://api.github.com/repos/linkedin/pinot/hooks","issue_events_url":"https://api.github.com/repos/linkedin/pinot/issues/events{/number}","events_url":"https://api.github.com/repos/linkedin/pinot/events","assignees_url":"https://api.github.com/repos/linkedin/pinot/assignees{/user}","branches_url":"https://api.github.com/repos/linkedin/pinot/branches{/branch}","tags_url":"https://api.github.com/repos/linkedin/pinot/tags","blobs_url":"https://api.github.com/repos/linkedin/pinot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/linkedin/pinot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/linkedin/pinot/git/refs{/sha}","trees_url":"https://api.github.com/repos/linkedin/pinot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/linkedin/pinot/statuses/{sha}","languages_url":"https://api.github.com/repos/linkedin/pinot/languages","stargazers_url":"https://api.github.com/repos/linkedin/pinot/stargazers","contributors_url":"https://api.github.com/repos/linkedin/pinot/contributors","subscribers_url":"https://api.github.com/repos/linkedin/pinot/subscribers","subscription_url":"https://api.github.com/repos/linkedin/pinot/subscription","commits_url":"https://api.github.com/repos/linkedin/pinot/commits{/sha}","git_commits_url":"https://api.github.com/repos/linkedin/pinot/git/commits{/sha}","comments_url":"https://api.github.com/repos/linkedin/pinot/comments{/number}","issue_comment_url":"https://api.github.com/repos/linkedin/pinot/issues/comments{/number}","contents_url":"https://api.github.com/repos/linkedin/pinot/contents/{+path}","compare_url":"https://api.github.com/repos/linkedin/pinot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/linkedin/pinot/merges","archive_url":"https://api.github.com/repos/linkedin/pinot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/linkedin/pinot/downloads","issues_url":"https://api.github.com/repos/linkedin/pinot/issues{/number}","pulls_url":"https://api.github.com/repos/linkedin/pinot/pulls{/number}","milestones_url":"https://api.github.com/repos/linkedin/pinot/milestones{/number}","notifications_url":"https://api.github.com/repos/linkedin/pinot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/linkedin/pinot/labels{/name}","releases_url":"https://api.github.com/repos/linkedin/pinot/releases{/id}","deployments_url":"https://api.github.com/repos/linkedin/pinot/deployments","created_at":"2014-05-19T23:27:48Z","updated_at":"2018-06-13T17:43:56Z","pushed_at":"2018-06-13T17:43:42Z","git_url":"git://github.com/linkedin/pinot.git","ssh_url":"git@github.com:linkedin/pinot.git","clone_url":"https://github.com/linkedin/pinot.git","svn_url":"https://github.com/linkedin/pinot","homepage":"https://github.com/linkedin/pinot/wiki","size":152183,"stargazers_count":1864,"watchers_count":1864,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":339,"mirror_url":null,"archived":false,"open_issues_count":167,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":339,"open_issues":167,"watchers":1864,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/linkedin/pinot/pulls/2886"},"html":{"href":"https://github.com/linkedin/pinot/pull/2886"},"issue":{"href":"https://api.github.com/repos/linkedin/pinot/issues/2886"},"comments":{"href":"https://api.github.com/repos/linkedin/pinot/issues/2886/comments"},"review_comments":{"href":"https://api.github.com/repos/linkedin/pinot/pulls/2886/comments"},"review_comment":{"href":"https://api.github.com/repos/linkedin/pinot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/linkedin/pinot/pulls/2886/commits"},"statuses":{"href":"https://api.github.com/repos/linkedin/pinot/statuses/87d9d6a03e72f227f8fa135e316c48347362001f"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Jackie-Jiang"}}