{"action":"created","comment":{"url":"https://api.github.com/repos/apache/incubator-druid/pulls/comments/222460269","pull_request_review_id":161345295,"id":222460269,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMjQ2MDI2OQ==","diff_hunk":"@@ -0,0 +1,233 @@\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+\n+package org.apache.druid.query.aggregation.bloom;\n+\n+import com.fasterxml.jackson.annotation.JsonCreator;\n+import com.fasterxml.jackson.annotation.JsonProperty;\n+import org.apache.commons.codec.binary.Base64;\n+import org.apache.druid.io.ByteBufferInputStream;\n+import org.apache.druid.java.util.common.StringUtils;\n+import org.apache.druid.query.ColumnSelectorPlus;\n+import org.apache.druid.query.aggregation.Aggregator;\n+import org.apache.druid.query.aggregation.AggregatorFactory;\n+import org.apache.druid.query.aggregation.AggregatorUtil;\n+import org.apache.druid.query.aggregation.BufferAggregator;\n+import org.apache.druid.query.aggregation.bloom.types.BloomFilterAggregatorColumnSelectorStrategy;\n+import org.apache.druid.query.aggregation.bloom.types.BloomFilterAggregatorColumnSelectorStrategyFactory;\n+import org.apache.druid.query.cache.CacheKeyBuilder;\n+import org.apache.druid.query.dimension.DimensionSpec;\n+import org.apache.druid.segment.ColumnSelectorFactory;\n+import org.apache.druid.segment.DimensionHandlerUtils;\n+import org.apache.hive.common.util.BloomKFilter;\n+\n+import java.nio.ByteBuffer;\n+import java.util.Collections;\n+import java.util.Comparator;\n+import java.util.List;\n+import java.util.Objects;\n+\n+public class BloomFilterAggregatorFactory extends AggregatorFactory\n+{\n+  protected static final BloomFilterAggregatorColumnSelectorStrategyFactory STRATEGY_FACTORY =\n+      new BloomFilterAggregatorColumnSelectorStrategyFactory();\n+\n+  private final String name;\n+  private final DimensionSpec field;\n+  private final int maxNumEntries;\n+\n+  @JsonCreator\n+  public BloomFilterAggregatorFactory(\n+      @JsonProperty(\"name\") String name,\n+      @JsonProperty(\"field\") final DimensionSpec field,\n+      @JsonProperty(\"maxNumEntries\") Integer maxNumEntries\n+  )\n+  {\n+    this.name = name;\n+    this.field = field;\n+    this.maxNumEntries = maxNumEntries != null ? maxNumEntries : 1500;","path":"extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/query/aggregation/bloom/BloomFilterAggregatorFactory.java","position":64,"original_position":64,"commit_id":"a75b278d842ea816cfedb36aa623276b3076b2d3","original_commit_id":"a75b278d842ea816cfedb36aa623276b3076b2d3","user":{"login":"leventov","id":609240,"node_id":"MDQ6VXNlcjYwOTI0MA==","avatar_url":"https://avatars0.githubusercontent.com/u/609240?v=4","gravatar_id":"","url":"https://api.github.com/users/leventov","html_url":"https://github.com/leventov","followers_url":"https://api.github.com/users/leventov/followers","following_url":"https://api.github.com/users/leventov/following{/other_user}","gists_url":"https://api.github.com/users/leventov/gists{/gist_id}","starred_url":"https://api.github.com/users/leventov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leventov/subscriptions","organizations_url":"https://api.github.com/users/leventov/orgs","repos_url":"https://api.github.com/users/leventov/repos","events_url":"https://api.github.com/users/leventov/events{/privacy}","received_events_url":"https://api.github.com/users/leventov/received_events","type":"User","site_admin":false},"body":"Please make a constant","created_at":"2018-10-03T20:41:43Z","updated_at":"2018-10-03T20:47:25Z","html_url":"https://github.com/apache/incubator-druid/pull/6397#discussion_r222460269","pull_request_url":"https://api.github.com/repos/apache/incubator-druid/pulls/6397","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-druid/pulls/comments/222460269"},"html":{"href":"https://github.com/apache/incubator-druid/pull/6397#discussion_r222460269"},"pull_request":{"href":"https://api.github.com/repos/apache/incubator-druid/pulls/6397"}}},"pull_request":{"url":"https://api.github.com/repos/apache/incubator-druid/pulls/6397","id":218882525,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4ODgyNTI1","html_url":"https://github.com/apache/incubator-druid/pull/6397","diff_url":"https://github.com/apache/incubator-druid/pull/6397.diff","patch_url":"https://github.com/apache/incubator-druid/pull/6397.patch","issue_url":"https://api.github.com/repos/apache/incubator-druid/issues/6397","number":6397,"state":"open","locked":false,"title":"Adds bloom filter aggregator to 'druid-bloom-filters' extension","user":{"login":"clintropolis","id":1577461,"node_id":"MDQ6VXNlcjE1Nzc0NjE=","avatar_url":"https://avatars1.githubusercontent.com/u/1577461?v=4","gravatar_id":"","url":"https://api.github.com/users/clintropolis","html_url":"https://github.com/clintropolis","followers_url":"https://api.github.com/users/clintropolis/followers","following_url":"https://api.github.com/users/clintropolis/following{/other_user}","gists_url":"https://api.github.com/users/clintropolis/gists{/gist_id}","starred_url":"https://api.github.com/users/clintropolis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clintropolis/subscriptions","organizations_url":"https://api.github.com/users/clintropolis/orgs","repos_url":"https://api.github.com/users/clintropolis/repos","events_url":"https://api.github.com/users/clintropolis/events{/privacy}","received_events_url":"https://api.github.com/users/clintropolis/received_events","type":"User","site_admin":false},"body":"This PR, building on top of the work introduced in #6222, extends `druid-bloom-filters` with an aggregator, allowing bloom filters to be computed from query results which can then be used as input to `bloom` filters in subsequent queries.\r\n\r\nexample query:\r\n```json\r\n{\r\n  \"queryType\": \"timeseries\",\r\n  \"dataSource\": \"wikiticker\",\r\n  \"intervals\": [ \"2015-09-12T00:00:00.000/2015-09-13T00:00:00.000\" ],\r\n  \"granularity\": \"day\",\r\n  \"aggregations\": [\r\n    {\r\n      \"type\": \"bloom\",\r\n      \"name\": \"userBloom\",\r\n      \"maxNumEntries\": 100000,\r\n      \"field\": {\r\n        \"type\":\"default\",\r\n        \"dimension\":\"user\",\r\n        \"outputType\": \"STRING\"\r\n      }\r\n    }\r\n  ]\r\n}\r\n```\r\nexample results:\r\n```json\r\n[{\"timestamp\":\"2015-09-12T00:00:00.000Z\",\"result\":{\"userBloom\":\"BAAAJhAAAA...\"}}]\r\n```","created_at":"2018-09-28T07:53:09Z","updated_at":"2018-10-03T20:47:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"47e8f1b4fa1618416374e4c60692fcf2bbfc7d8c","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/incubator-druid/pulls/6397/commits","review_comments_url":"https://api.github.com/repos/apache/incubator-druid/pulls/6397/comments","review_comment_url":"https://api.github.com/repos/apache/incubator-druid/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/incubator-druid/issues/6397/comments","statuses_url":"https://api.github.com/repos/apache/incubator-druid/statuses/a75b278d842ea816cfedb36aa623276b3076b2d3","head":{"label":"clintropolis:bloom-filter-aggregator","ref":"bloom-filter-aggregator","sha":"a75b278d842ea816cfedb36aa623276b3076b2d3","user":{"login":"clintropolis","id":1577461,"node_id":"MDQ6VXNlcjE1Nzc0NjE=","avatar_url":"https://avatars1.githubusercontent.com/u/1577461?v=4","gravatar_id":"","url":"https://api.github.com/users/clintropolis","html_url":"https://github.com/clintropolis","followers_url":"https://api.github.com/users/clintropolis/followers","following_url":"https://api.github.com/users/clintropolis/following{/other_user}","gists_url":"https://api.github.com/users/clintropolis/gists{/gist_id}","starred_url":"https://api.github.com/users/clintropolis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clintropolis/subscriptions","organizations_url":"https://api.github.com/users/clintropolis/orgs","repos_url":"https://api.github.com/users/clintropolis/repos","events_url":"https://api.github.com/users/clintropolis/events{/privacy}","received_events_url":"https://api.github.com/users/clintropolis/received_events","type":"User","site_admin":false},"repo":{"id":122282812,"node_id":"MDEwOlJlcG9zaXRvcnkxMjIyODI4MTI=","name":"druid","full_name":"clintropolis/druid","private":false,"owner":{"login":"clintropolis","id":1577461,"node_id":"MDQ6VXNlcjE1Nzc0NjE=","avatar_url":"https://avatars1.githubusercontent.com/u/1577461?v=4","gravatar_id":"","url":"https://api.github.com/users/clintropolis","html_url":"https://github.com/clintropolis","followers_url":"https://api.github.com/users/clintropolis/followers","following_url":"https://api.github.com/users/clintropolis/following{/other_user}","gists_url":"https://api.github.com/users/clintropolis/gists{/gist_id}","starred_url":"https://api.github.com/users/clintropolis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clintropolis/subscriptions","organizations_url":"https://api.github.com/users/clintropolis/orgs","repos_url":"https://api.github.com/users/clintropolis/repos","events_url":"https://api.github.com/users/clintropolis/events{/privacy}","received_events_url":"https://api.github.com/users/clintropolis/received_events","type":"User","site_admin":false},"html_url":"https://github.com/clintropolis/druid","description":"Column oriented distributed data store ideal for powering interactive applications","fork":true,"url":"https://api.github.com/repos/clintropolis/druid","forks_url":"https://api.github.com/repos/clintropolis/druid/forks","keys_url":"https://api.github.com/repos/clintropolis/druid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clintropolis/druid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clintropolis/druid/teams","hooks_url":"https://api.github.com/repos/clintropolis/druid/hooks","issue_events_url":"https://api.github.com/repos/clintropolis/druid/issues/events{/number}","events_url":"https://api.github.com/repos/clintropolis/druid/events","assignees_url":"https://api.github.com/repos/clintropolis/druid/assignees{/user}","branches_url":"https://api.github.com/repos/clintropolis/druid/branches{/branch}","tags_url":"https://api.github.com/repos/clintropolis/druid/tags","blobs_url":"https://api.github.com/repos/clintropolis/druid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clintropolis/druid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clintropolis/druid/git/refs{/sha}","trees_url":"https://api.github.com/repos/clintropolis/druid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clintropolis/druid/statuses/{sha}","languages_url":"https://api.github.com/repos/clintropolis/druid/languages","stargazers_url":"https://api.github.com/repos/clintropolis/druid/stargazers","contributors_url":"https://api.github.com/repos/clintropolis/druid/contributors","subscribers_url":"https://api.github.com/repos/clintropolis/druid/subscribers","subscription_url":"https://api.github.com/repos/clintropolis/druid/subscription","commits_url":"https://api.github.com/repos/clintropolis/druid/commits{/sha}","git_commits_url":"https://api.github.com/repos/clintropolis/druid/git/commits{/sha}","comments_url":"https://api.github.com/repos/clintropolis/druid/comments{/number}","issue_comment_url":"https://api.github.com/repos/clintropolis/druid/issues/comments{/number}","contents_url":"https://api.github.com/repos/clintropolis/druid/contents/{+path}","compare_url":"https://api.github.com/repos/clintropolis/druid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clintropolis/druid/merges","archive_url":"https://api.github.com/repos/clintropolis/druid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clintropolis/druid/downloads","issues_url":"https://api.github.com/repos/clintropolis/druid/issues{/number}","pulls_url":"https://api.github.com/repos/clintropolis/druid/pulls{/number}","milestones_url":"https://api.github.com/repos/clintropolis/druid/milestones{/number}","notifications_url":"https://api.github.com/repos/clintropolis/druid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clintropolis/druid/labels{/name}","releases_url":"https://api.github.com/repos/clintropolis/druid/releases{/id}","deployments_url":"https://api.github.com/repos/clintropolis/druid/deployments","created_at":"2018-02-21T02:18:54Z","updated_at":"2018-07-06T15:33:16Z","pushed_at":"2018-10-02T21:49:50Z","git_url":"git://github.com/clintropolis/druid.git","ssh_url":"git@github.com:clintropolis/druid.git","clone_url":"https://github.com/clintropolis/druid.git","svn_url":"https://github.com/clintropolis/druid","homepage":"http://druid.io","size":149247,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"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":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"6f44e568db6cb6626c726c69459e55cc2315c237","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":6358188,"node_id":"MDEwOlJlcG9zaXRvcnk2MzU4MTg4","name":"incubator-druid","full_name":"apache/incubator-druid","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/incubator-druid","description":"Apache Druid (Incubating) - Column oriented distributed data store ideal for powering interactive applications","fork":false,"url":"https://api.github.com/repos/apache/incubator-druid","forks_url":"https://api.github.com/repos/apache/incubator-druid/forks","keys_url":"https://api.github.com/repos/apache/incubator-druid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/incubator-druid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/incubator-druid/teams","hooks_url":"https://api.github.com/repos/apache/incubator-druid/hooks","issue_events_url":"https://api.github.com/repos/apache/incubator-druid/issues/events{/number}","events_url":"https://api.github.com/repos/apache/incubator-druid/events","assignees_url":"https://api.github.com/repos/apache/incubator-druid/assignees{/user}","branches_url":"https://api.github.com/repos/apache/incubator-druid/branches{/branch}","tags_url":"https://api.github.com/repos/apache/incubator-druid/tags","blobs_url":"https://api.github.com/repos/apache/incubator-druid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/incubator-druid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/incubator-druid/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/incubator-druid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/incubator-druid/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/incubator-druid/languages","stargazers_url":"https://api.github.com/repos/apache/incubator-druid/stargazers","contributors_url":"https://api.github.com/repos/apache/incubator-druid/contributors","subscribers_url":"https://api.github.com/repos/apache/incubator-druid/subscribers","subscription_url":"https://api.github.com/repos/apache/incubator-druid/subscription","commits_url":"https://api.github.com/repos/apache/incubator-druid/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/incubator-druid/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/incubator-druid/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/incubator-druid/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/incubator-druid/contents/{+path}","compare_url":"https://api.github.com/repos/apache/incubator-druid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/incubator-druid/merges","archive_url":"https://api.github.com/repos/apache/incubator-druid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/incubator-druid/downloads","issues_url":"https://api.github.com/repos/apache/incubator-druid/issues{/number}","pulls_url":"https://api.github.com/repos/apache/incubator-druid/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/incubator-druid/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/incubator-druid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/incubator-druid/labels{/name}","releases_url":"https://api.github.com/repos/apache/incubator-druid/releases{/id}","deployments_url":"https://api.github.com/repos/apache/incubator-druid/deployments","created_at":"2012-10-23T19:08:07Z","updated_at":"2018-10-02T17:51:00Z","pushed_at":"2018-10-03T16:41:14Z","git_url":"git://github.com/apache/incubator-druid.git","ssh_url":"git@github.com:apache/incubator-druid.git","clone_url":"https://github.com/apache/incubator-druid.git","svn_url":"https://github.com/apache/incubator-druid","homepage":"http://druid.io","size":148551,"stargazers_count":7046,"watchers_count":7046,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1734,"mirror_url":null,"archived":false,"open_issues_count":1147,"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":1734,"open_issues":1147,"watchers":7046,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-druid/pulls/6397"},"html":{"href":"https://github.com/apache/incubator-druid/pull/6397"},"issue":{"href":"https://api.github.com/repos/apache/incubator-druid/issues/6397"},"comments":{"href":"https://api.github.com/repos/apache/incubator-druid/issues/6397/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/incubator-druid/pulls/6397/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/incubator-druid/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/incubator-druid/pulls/6397/commits"},"statuses":{"href":"https://api.github.com/repos/apache/incubator-druid/statuses/a75b278d842ea816cfedb36aa623276b3076b2d3"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"leventov"}}