{"action":"created","comment":{"url":"https://api.github.com/repos/apache/parquet-mr/pulls/comments/226832416","pull_request_review_id":166754715,"id":226832416,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNjgzMjQxNg==","diff_hunk":"@@ -0,0 +1,373 @@\n+/*\n+ * Licensed to the Apache Software Foundation (ASF) under one\n+ * or more contributor license agreements.  See the NOTICE file\n+ * distributed with this work for additional information\n+ * regarding copyright ownership.  The ASF licenses this file\n+ * to you under the Apache License, Version 2.0 (the\n+ * \"License\"); you may not use this file except in compliance\n+ * with the License.  You may obtain a copy of the License at\n+ *\n+ *   http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing,\n+ * software distributed under the License is distributed on an\n+ * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+ * KIND, either express or implied.  See the License for the\n+ * specific language governing permissions and limitations\n+ * under the License.\n+ */\n+package org.apache.parquet.column.values.bloomfilter;\n+\n+import com.google.common.hash.HashFunction;\n+import com.google.common.hash.Hashing;\n+import org.apache.parquet.Preconditions;\n+import org.apache.parquet.bytes.BytesUtils;\n+import org.apache.parquet.io.api.Binary;\n+\n+import java.io.IOException;\n+import java.io.OutputStream;\n+import java.nio.ByteBuffer;\n+import java.nio.ByteOrder;\n+import java.nio.IntBuffer;\n+\n+/**\n+ * A Bloom filter is a compact structure to indicate whether an item is not in a set or probably\n+ * in a set. BloomFilter class stores a bit set represents a elements set, a hash strategy and a\n+ * Bloom filter algorithm.\n+ *\n+ * This Bloom filter is implemented using block-based Bloom filter algorithm from Putze et al.'s\n+ * \"Cache-, Hash- and Space-Efficient Bloom filters\". The basic idea is to hash the item to a tiny\n+ * Bloom filter which size fit a single cache line or smaller. This implementation sets 8 bits in\n+ * each tiny Bloom filter. Each tiny Bloom filter is 32 bytes to take advantage of 32-byte SIMD\n+ * instruction.\n+ */\n+\n+public class BloomFilter {\n+  // Bloom filter Hash strategy .\n+  public enum HashStrategy {\n+    MURMUR3_X64_128,\n+  }\n+\n+  // Bloom filter algorithm.\n+  public enum Algorithm {\n+    BLOCK,\n+  }\n+\n+  // Bytes in a tiny Bloom filter block.\n+  private static final int BYTES_PER_FILTER_BLOCK = 32;\n+\n+  // Default seed for hash function, it comes from System.nanoTime().\n+  private static final int DEFAULT_SEED = 1361930890;\n+\n+  // Minimum Bloom filter size, set to size of a tiny Bloom filter block\n+  public static final int MINIMUM_BLOOM_FILTER_BYTES = 32;\n+\n+  // Maximum Bloom filter size, it sets to default HDFS block size for upper boundary check\n+  // This should be re-consider when implementing write side logic.\n+  public static final int MAXIMUM_BLOOM_FILTER_BYTES = 128 * 1024 * 1024;\n+\n+  // The number of bits to set in a tiny Bloom filter\n+  private static final int BITS_SET_PER_BLOCK = 8;\n+\n+  // The header of Bloom filter, it includes number of bytes, algorithm and hash enumeration.\n+  public static final int HEADER_SIZE = 12;\n+\n+  // Hash strategy used in this Bloom filter.\n+  public final HashStrategy hashStrategy;\n+\n+  // Algorithm used in this Bloom filter.\n+  public final Algorithm algorithm;\n+\n+  // The underlying byte array for Bloom filter bitset.\n+  private byte[] bitset;\n+\n+  // A integer array buffer of underlying bitset to help setting bits.","path":"parquet-column/src/main/java/org/apache/parquet/column/values/bloomfilter/BloomFilter.java","position":84,"original_position":84,"commit_id":"81c306329d8a59aa6a76a91a210ea98bcb4ff192","original_commit_id":"81c306329d8a59aa6a76a91a210ea98bcb4ff192","user":{"login":"cjjnjust","id":3960228,"node_id":"MDQ6VXNlcjM5NjAyMjg=","avatar_url":"https://avatars1.githubusercontent.com/u/3960228?v=4","gravatar_id":"","url":"https://api.github.com/users/cjjnjust","html_url":"https://github.com/cjjnjust","followers_url":"https://api.github.com/users/cjjnjust/followers","following_url":"https://api.github.com/users/cjjnjust/following{/other_user}","gists_url":"https://api.github.com/users/cjjnjust/gists{/gist_id}","starred_url":"https://api.github.com/users/cjjnjust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjjnjust/subscriptions","organizations_url":"https://api.github.com/users/cjjnjust/orgs","repos_url":"https://api.github.com/users/cjjnjust/repos","events_url":"https://api.github.com/users/cjjnjust/events{/privacy}","received_events_url":"https://api.github.com/users/cjjnjust/received_events","type":"User","site_admin":false},"body":"If we use the int array, we have to afford one more copy when writing to OutputStream. I haven't find a way to convert int array to byte array without copy in java.","created_at":"2018-10-20T16:34:50Z","updated_at":"2018-10-20T16:34:51Z","html_url":"https://github.com/apache/parquet-mr/pull/521#discussion_r226832416","pull_request_url":"https://api.github.com/repos/apache/parquet-mr/pulls/521","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/apache/parquet-mr/pulls/comments/226832416"},"html":{"href":"https://github.com/apache/parquet-mr/pull/521#discussion_r226832416"},"pull_request":{"href":"https://api.github.com/repos/apache/parquet-mr/pulls/521"}},"in_reply_to_id":223197493},"pull_request":{"url":"https://api.github.com/repos/apache/parquet-mr/pulls/521","id":214100179,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE0MTAwMTc5","html_url":"https://github.com/apache/parquet-mr/pull/521","diff_url":"https://github.com/apache/parquet-mr/pull/521.diff","patch_url":"https://github.com/apache/parquet-mr/pull/521.patch","issue_url":"https://api.github.com/repos/apache/parquet-mr/issues/521","number":521,"state":"open","locked":false,"title":"PARQUET-1328: Add Bloom filter reader and writer","user":{"login":"cjjnjust","id":3960228,"node_id":"MDQ6VXNlcjM5NjAyMjg=","avatar_url":"https://avatars1.githubusercontent.com/u/3960228?v=4","gravatar_id":"","url":"https://api.github.com/users/cjjnjust","html_url":"https://github.com/cjjnjust","followers_url":"https://api.github.com/users/cjjnjust/followers","following_url":"https://api.github.com/users/cjjnjust/following{/other_user}","gists_url":"https://api.github.com/users/cjjnjust/gists{/gist_id}","starred_url":"https://api.github.com/users/cjjnjust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjjnjust/subscriptions","organizations_url":"https://api.github.com/users/cjjnjust/orgs","repos_url":"https://api.github.com/users/cjjnjust/repos","events_url":"https://api.github.com/users/cjjnjust/events{/privacy}","received_events_url":"https://api.github.com/users/cjjnjust/received_events","type":"User","site_admin":false},"body":"This is an early PR for Bloom filter reader and writer, which is used to discovery some potential concerns for parquet-format and Bloom filter spec. ","created_at":"2018-09-08T15:22:19Z","updated_at":"2018-10-20T16:34:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6606ca9f710a92068853ab80e8445e3a64122fec","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/parquet-mr/pulls/521/commits","review_comments_url":"https://api.github.com/repos/apache/parquet-mr/pulls/521/comments","review_comment_url":"https://api.github.com/repos/apache/parquet-mr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/parquet-mr/issues/521/comments","statuses_url":"https://api.github.com/repos/apache/parquet-mr/statuses/81c306329d8a59aa6a76a91a210ea98bcb4ff192","head":{"label":"cjjnjust:PARQUET-1328","ref":"PARQUET-1328","sha":"81c306329d8a59aa6a76a91a210ea98bcb4ff192","user":{"login":"cjjnjust","id":3960228,"node_id":"MDQ6VXNlcjM5NjAyMjg=","avatar_url":"https://avatars1.githubusercontent.com/u/3960228?v=4","gravatar_id":"","url":"https://api.github.com/users/cjjnjust","html_url":"https://github.com/cjjnjust","followers_url":"https://api.github.com/users/cjjnjust/followers","following_url":"https://api.github.com/users/cjjnjust/following{/other_user}","gists_url":"https://api.github.com/users/cjjnjust/gists{/gist_id}","starred_url":"https://api.github.com/users/cjjnjust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjjnjust/subscriptions","organizations_url":"https://api.github.com/users/cjjnjust/orgs","repos_url":"https://api.github.com/users/cjjnjust/repos","events_url":"https://api.github.com/users/cjjnjust/events{/privacy}","received_events_url":"https://api.github.com/users/cjjnjust/received_events","type":"User","site_admin":false},"repo":{"id":101361250,"node_id":"MDEwOlJlcG9zaXRvcnkxMDEzNjEyNTA=","name":"parquet-mr","full_name":"cjjnjust/parquet-mr","private":false,"owner":{"login":"cjjnjust","id":3960228,"node_id":"MDQ6VXNlcjM5NjAyMjg=","avatar_url":"https://avatars1.githubusercontent.com/u/3960228?v=4","gravatar_id":"","url":"https://api.github.com/users/cjjnjust","html_url":"https://github.com/cjjnjust","followers_url":"https://api.github.com/users/cjjnjust/followers","following_url":"https://api.github.com/users/cjjnjust/following{/other_user}","gists_url":"https://api.github.com/users/cjjnjust/gists{/gist_id}","starred_url":"https://api.github.com/users/cjjnjust/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjjnjust/subscriptions","organizations_url":"https://api.github.com/users/cjjnjust/orgs","repos_url":"https://api.github.com/users/cjjnjust/repos","events_url":"https://api.github.com/users/cjjnjust/events{/privacy}","received_events_url":"https://api.github.com/users/cjjnjust/received_events","type":"User","site_admin":false},"html_url":"https://github.com/cjjnjust/parquet-mr","description":"Mirror of Apache Parquet","fork":true,"url":"https://api.github.com/repos/cjjnjust/parquet-mr","forks_url":"https://api.github.com/repos/cjjnjust/parquet-mr/forks","keys_url":"https://api.github.com/repos/cjjnjust/parquet-mr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cjjnjust/parquet-mr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cjjnjust/parquet-mr/teams","hooks_url":"https://api.github.com/repos/cjjnjust/parquet-mr/hooks","issue_events_url":"https://api.github.com/repos/cjjnjust/parquet-mr/issues/events{/number}","events_url":"https://api.github.com/repos/cjjnjust/parquet-mr/events","assignees_url":"https://api.github.com/repos/cjjnjust/parquet-mr/assignees{/user}","branches_url":"https://api.github.com/repos/cjjnjust/parquet-mr/branches{/branch}","tags_url":"https://api.github.com/repos/cjjnjust/parquet-mr/tags","blobs_url":"https://api.github.com/repos/cjjnjust/parquet-mr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cjjnjust/parquet-mr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cjjnjust/parquet-mr/git/refs{/sha}","trees_url":"https://api.github.com/repos/cjjnjust/parquet-mr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cjjnjust/parquet-mr/statuses/{sha}","languages_url":"https://api.github.com/repos/cjjnjust/parquet-mr/languages","stargazers_url":"https://api.github.com/repos/cjjnjust/parquet-mr/stargazers","contributors_url":"https://api.github.com/repos/cjjnjust/parquet-mr/contributors","subscribers_url":"https://api.github.com/repos/cjjnjust/parquet-mr/subscribers","subscription_url":"https://api.github.com/repos/cjjnjust/parquet-mr/subscription","commits_url":"https://api.github.com/repos/cjjnjust/parquet-mr/commits{/sha}","git_commits_url":"https://api.github.com/repos/cjjnjust/parquet-mr/git/commits{/sha}","comments_url":"https://api.github.com/repos/cjjnjust/parquet-mr/comments{/number}","issue_comment_url":"https://api.github.com/repos/cjjnjust/parquet-mr/issues/comments{/number}","contents_url":"https://api.github.com/repos/cjjnjust/parquet-mr/contents/{+path}","compare_url":"https://api.github.com/repos/cjjnjust/parquet-mr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cjjnjust/parquet-mr/merges","archive_url":"https://api.github.com/repos/cjjnjust/parquet-mr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cjjnjust/parquet-mr/downloads","issues_url":"https://api.github.com/repos/cjjnjust/parquet-mr/issues{/number}","pulls_url":"https://api.github.com/repos/cjjnjust/parquet-mr/pulls{/number}","milestones_url":"https://api.github.com/repos/cjjnjust/parquet-mr/milestones{/number}","notifications_url":"https://api.github.com/repos/cjjnjust/parquet-mr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cjjnjust/parquet-mr/labels{/name}","releases_url":"https://api.github.com/repos/cjjnjust/parquet-mr/releases{/id}","deployments_url":"https://api.github.com/repos/cjjnjust/parquet-mr/deployments","created_at":"2017-08-25T03:16:05Z","updated_at":"2018-07-24T03:59:59Z","pushed_at":"2018-09-08T15:09:38Z","git_url":"git://github.com/cjjnjust/parquet-mr.git","ssh_url":"git@github.com:cjjnjust/parquet-mr.git","clone_url":"https://github.com/cjjnjust/parquet-mr.git","svn_url":"https://github.com/cjjnjust/parquet-mr","homepage":null,"size":15469,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"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":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"d692ce3a4205a4274e97dce6add93c687e12a9c2","user":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","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":20675636,"node_id":"MDEwOlJlcG9zaXRvcnkyMDY3NTYzNg==","name":"parquet-mr","full_name":"apache/parquet-mr","private":false,"owner":{"login":"apache","id":47359,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQ3MzU5","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},"html_url":"https://github.com/apache/parquet-mr","description":"Apache Parquet","fork":false,"url":"https://api.github.com/repos/apache/parquet-mr","forks_url":"https://api.github.com/repos/apache/parquet-mr/forks","keys_url":"https://api.github.com/repos/apache/parquet-mr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/parquet-mr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/parquet-mr/teams","hooks_url":"https://api.github.com/repos/apache/parquet-mr/hooks","issue_events_url":"https://api.github.com/repos/apache/parquet-mr/issues/events{/number}","events_url":"https://api.github.com/repos/apache/parquet-mr/events","assignees_url":"https://api.github.com/repos/apache/parquet-mr/assignees{/user}","branches_url":"https://api.github.com/repos/apache/parquet-mr/branches{/branch}","tags_url":"https://api.github.com/repos/apache/parquet-mr/tags","blobs_url":"https://api.github.com/repos/apache/parquet-mr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/parquet-mr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/parquet-mr/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/parquet-mr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/parquet-mr/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/parquet-mr/languages","stargazers_url":"https://api.github.com/repos/apache/parquet-mr/stargazers","contributors_url":"https://api.github.com/repos/apache/parquet-mr/contributors","subscribers_url":"https://api.github.com/repos/apache/parquet-mr/subscribers","subscription_url":"https://api.github.com/repos/apache/parquet-mr/subscription","commits_url":"https://api.github.com/repos/apache/parquet-mr/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/parquet-mr/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/parquet-mr/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/parquet-mr/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/parquet-mr/contents/{+path}","compare_url":"https://api.github.com/repos/apache/parquet-mr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/parquet-mr/merges","archive_url":"https://api.github.com/repos/apache/parquet-mr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/parquet-mr/downloads","issues_url":"https://api.github.com/repos/apache/parquet-mr/issues{/number}","pulls_url":"https://api.github.com/repos/apache/parquet-mr/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/parquet-mr/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/parquet-mr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/parquet-mr/labels{/name}","releases_url":"https://api.github.com/repos/apache/parquet-mr/releases{/id}","deployments_url":"https://api.github.com/repos/apache/parquet-mr/deployments","created_at":"2014-06-10T07:00:07Z","updated_at":"2018-10-18T19:59:31Z","pushed_at":"2018-10-19T08:08:40Z","git_url":"git://github.com/apache/parquet-mr.git","ssh_url":"git@github.com:apache/parquet-mr.git","clone_url":"https://github.com/apache/parquet-mr.git","svn_url":"https://github.com/apache/parquet-mr","homepage":"","size":15666,"stargazers_count":685,"watchers_count":685,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":602,"mirror_url":null,"archived":false,"open_issues_count":72,"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":602,"open_issues":72,"watchers":685,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/parquet-mr/pulls/521"},"html":{"href":"https://github.com/apache/parquet-mr/pull/521"},"issue":{"href":"https://api.github.com/repos/apache/parquet-mr/issues/521"},"comments":{"href":"https://api.github.com/repos/apache/parquet-mr/issues/521/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/parquet-mr/pulls/521/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/parquet-mr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/parquet-mr/pulls/521/commits"},"statuses":{"href":"https://api.github.com/repos/apache/parquet-mr/statuses/81c306329d8a59aa6a76a91a210ea98bcb4ff192"}},"author_association":"NONE"}}
{"actor":{"display_login":"cjjnjust"}}