{"action":"created","comment":{"url":"https://api.github.com/repos/yahoo/bullet-storm/pulls/comments/97662609","pull_request_review_id":18279704,"id":97662609,"diff_hunk":"@@ -149,26 +136,64 @@ public void configure(Map configuration) {\n         return Optional.empty();\n     }\n \n+    /**\n+     * Returns a new {@link Strategy} instance that can handle this aggregation.\n+     *\n+     * @return the created instance of a strategy that can implement the provided AggregationType or null if it cannot.\n+     */\n+    Strategy findStrategy() {\n+        if (type == AggregationType.RAW) {\n+            return new Raw(this);\n+        }\n+\n+        boolean haveFields = !isEmpty(fields);\n+\n+        if (type == AggregationType.COUNT_DISTINCT && haveFields) {\n+            return new CountDistinct(this);\n+        }\n+\n+        boolean haveOperations = !isEmpty(groupOperations);\n+        if (type == AggregationType.GROUP) {\n+            if (haveFields) {\n+                return new GroupBy(this);\n+            }\n+            // We don't have fields\n+            if (haveOperations) {\n+                return new GroupAll(this);\n+            }\n+        }\n+\n+        return null;\n+    }\n+\n+    private static boolean isEmpty(Map map) {\n+        return map == null || map.isEmpty();\n+    }\n+\n+    private static boolean isEmpty(Collection collection) {\n+        return collection == null || collection.isEmpty();\n+    }\n+\n     private Set<GroupOperation> getOperations() {\n         if (isEmpty(attributes)) {\n-            return null;\n+            return Collections.emptySet();\n         }\n         return parseOperations(attributes.get(OPERATIONS));\n     }\n \n     private Set<GroupOperation> parseOperations(Object object) {\n         if (object == null) {\n-            return null;\n+            return Collections.emptySet();\n         }\n         try {\n             // Unchecked cast needed.\n             List<Map<String, String>> operations = (List<Map<String, String>>) object;\n             // Return a list of distinct, non-null, GroupOperations\n             return operations.stream().map(Aggregation::makeGroupOperation)\n-                                      .filter(Objects::nonNull)\n-                                      .collect(Collectors.toSet());\n+                    .filter(Objects::nonNull)\n+                    .collect(Collectors.toSet());","path":"src/main/java/com/yahoo/bullet/parsing/Aggregation.java","position":165,"original_position":165,"commit_id":"98fa41f520c1471ecb038668f13b545c77c7c285","original_commit_id":"98fa41f520c1471ecb038668f13b545c77c7c285","user":{"login":"NathanSpeidel","id":10698988,"avatar_url":"https://avatars.githubusercontent.com/u/10698988?v=3","gravatar_id":"","url":"https://api.github.com/users/NathanSpeidel","html_url":"https://github.com/NathanSpeidel","followers_url":"https://api.github.com/users/NathanSpeidel/followers","following_url":"https://api.github.com/users/NathanSpeidel/following{/other_user}","gists_url":"https://api.github.com/users/NathanSpeidel/gists{/gist_id}","starred_url":"https://api.github.com/users/NathanSpeidel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NathanSpeidel/subscriptions","organizations_url":"https://api.github.com/users/NathanSpeidel/orgs","repos_url":"https://api.github.com/users/NathanSpeidel/repos","events_url":"https://api.github.com/users/NathanSpeidel/events{/privacy}","received_events_url":"https://api.github.com/users/NathanSpeidel/received_events","type":"User","site_admin":false},"body":"Indentation? ","created_at":"2017-01-24T22:05:35Z","updated_at":"2017-01-24T22:05:35Z","html_url":"https://github.com/yahoo/bullet-storm/pull/8#discussion_r97662609","pull_request_url":"https://api.github.com/repos/yahoo/bullet-storm/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/yahoo/bullet-storm/pulls/comments/97662609"},"html":{"href":"https://github.com/yahoo/bullet-storm/pull/8#discussion_r97662609"},"pull_request":{"href":"https://api.github.com/repos/yahoo/bullet-storm/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/yahoo/bullet-storm/pulls/8","id":102811759,"html_url":"https://github.com/yahoo/bullet-storm/pull/8","diff_url":"https://github.com/yahoo/bullet-storm/pull/8.diff","patch_url":"https://github.com/yahoo/bullet-storm/pull/8.patch","issue_url":"https://api.github.com/repos/yahoo/bullet-storm/issues/8","number":8,"state":"open","locked":false,"title":"Group by aggregation","user":{"login":"akshaisarma","id":1041753,"avatar_url":"https://avatars.githubusercontent.com/u/1041753?v=3","gravatar_id":"","url":"https://api.github.com/users/akshaisarma","html_url":"https://github.com/akshaisarma","followers_url":"https://api.github.com/users/akshaisarma/followers","following_url":"https://api.github.com/users/akshaisarma/following{/other_user}","gists_url":"https://api.github.com/users/akshaisarma/gists{/gist_id}","starred_url":"https://api.github.com/users/akshaisarma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akshaisarma/subscriptions","organizations_url":"https://api.github.com/users/akshaisarma/orgs","repos_url":"https://api.github.com/users/akshaisarma/repos","events_url":"https://api.github.com/users/akshaisarma/events{/privacy}","received_events_url":"https://api.github.com/users/akshaisarma/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-01-23T22:11:38Z","updated_at":"2017-01-24T22:05:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4a054139a4b238c9d4fcb6b3596a1c7fe0d6509f","assignee":{"login":"NathanSpeidel","id":10698988,"avatar_url":"https://avatars.githubusercontent.com/u/10698988?v=3","gravatar_id":"","url":"https://api.github.com/users/NathanSpeidel","html_url":"https://github.com/NathanSpeidel","followers_url":"https://api.github.com/users/NathanSpeidel/followers","following_url":"https://api.github.com/users/NathanSpeidel/following{/other_user}","gists_url":"https://api.github.com/users/NathanSpeidel/gists{/gist_id}","starred_url":"https://api.github.com/users/NathanSpeidel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NathanSpeidel/subscriptions","organizations_url":"https://api.github.com/users/NathanSpeidel/orgs","repos_url":"https://api.github.com/users/NathanSpeidel/repos","events_url":"https://api.github.com/users/NathanSpeidel/events{/privacy}","received_events_url":"https://api.github.com/users/NathanSpeidel/received_events","type":"User","site_admin":false},"assignees":[{"login":"NathanSpeidel","id":10698988,"avatar_url":"https://avatars.githubusercontent.com/u/10698988?v=3","gravatar_id":"","url":"https://api.github.com/users/NathanSpeidel","html_url":"https://github.com/NathanSpeidel","followers_url":"https://api.github.com/users/NathanSpeidel/followers","following_url":"https://api.github.com/users/NathanSpeidel/following{/other_user}","gists_url":"https://api.github.com/users/NathanSpeidel/gists{/gist_id}","starred_url":"https://api.github.com/users/NathanSpeidel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NathanSpeidel/subscriptions","organizations_url":"https://api.github.com/users/NathanSpeidel/orgs","repos_url":"https://api.github.com/users/NathanSpeidel/repos","events_url":"https://api.github.com/users/NathanSpeidel/events{/privacy}","received_events_url":"https://api.github.com/users/NathanSpeidel/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/yahoo/bullet-storm/milestones/3","html_url":"https://github.com/yahoo/bullet-storm/milestone/3","labels_url":"https://api.github.com/repos/yahoo/bullet-storm/milestones/3/labels","id":2272796,"number":3,"title":"0.2.0","description":"","creator":{"login":"akshaisarma","id":1041753,"avatar_url":"https://avatars.githubusercontent.com/u/1041753?v=3","gravatar_id":"","url":"https://api.github.com/users/akshaisarma","html_url":"https://github.com/akshaisarma","followers_url":"https://api.github.com/users/akshaisarma/followers","following_url":"https://api.github.com/users/akshaisarma/following{/other_user}","gists_url":"https://api.github.com/users/akshaisarma/gists{/gist_id}","starred_url":"https://api.github.com/users/akshaisarma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akshaisarma/subscriptions","organizations_url":"https://api.github.com/users/akshaisarma/orgs","repos_url":"https://api.github.com/users/akshaisarma/repos","events_url":"https://api.github.com/users/akshaisarma/events{/privacy}","received_events_url":"https://api.github.com/users/akshaisarma/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":0,"state":"open","created_at":"2017-01-23T22:15:36Z","updated_at":"2017-01-24T00:38:56Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/yahoo/bullet-storm/pulls/8/commits","review_comments_url":"https://api.github.com/repos/yahoo/bullet-storm/pulls/8/comments","review_comment_url":"https://api.github.com/repos/yahoo/bullet-storm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yahoo/bullet-storm/issues/8/comments","statuses_url":"https://api.github.com/repos/yahoo/bullet-storm/statuses/98fa41f520c1471ecb038668f13b545c77c7c285","head":{"label":"yahoo:group-by-aggregation","ref":"group-by-aggregation","sha":"98fa41f520c1471ecb038668f13b545c77c7c285","user":{"login":"yahoo","id":16574,"avatar_url":"https://avatars.githubusercontent.com/u/16574?v=3","gravatar_id":"","url":"https://api.github.com/users/yahoo","html_url":"https://github.com/yahoo","followers_url":"https://api.github.com/users/yahoo/followers","following_url":"https://api.github.com/users/yahoo/following{/other_user}","gists_url":"https://api.github.com/users/yahoo/gists{/gist_id}","starred_url":"https://api.github.com/users/yahoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yahoo/subscriptions","organizations_url":"https://api.github.com/users/yahoo/orgs","repos_url":"https://api.github.com/users/yahoo/repos","events_url":"https://api.github.com/users/yahoo/events{/privacy}","received_events_url":"https://api.github.com/users/yahoo/received_events","type":"Organization","site_admin":false},"repo":{"id":73521865,"name":"bullet-storm","full_name":"yahoo/bullet-storm","owner":{"login":"yahoo","id":16574,"avatar_url":"https://avatars.githubusercontent.com/u/16574?v=3","gravatar_id":"","url":"https://api.github.com/users/yahoo","html_url":"https://github.com/yahoo","followers_url":"https://api.github.com/users/yahoo/followers","following_url":"https://api.github.com/users/yahoo/following{/other_user}","gists_url":"https://api.github.com/users/yahoo/gists{/gist_id}","starred_url":"https://api.github.com/users/yahoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yahoo/subscriptions","organizations_url":"https://api.github.com/users/yahoo/orgs","repos_url":"https://api.github.com/users/yahoo/repos","events_url":"https://api.github.com/users/yahoo/events{/privacy}","received_events_url":"https://api.github.com/users/yahoo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yahoo/bullet-storm","description":null,"fork":false,"url":"https://api.github.com/repos/yahoo/bullet-storm","forks_url":"https://api.github.com/repos/yahoo/bullet-storm/forks","keys_url":"https://api.github.com/repos/yahoo/bullet-storm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yahoo/bullet-storm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yahoo/bullet-storm/teams","hooks_url":"https://api.github.com/repos/yahoo/bullet-storm/hooks","issue_events_url":"https://api.github.com/repos/yahoo/bullet-storm/issues/events{/number}","events_url":"https://api.github.com/repos/yahoo/bullet-storm/events","assignees_url":"https://api.github.com/repos/yahoo/bullet-storm/assignees{/user}","branches_url":"https://api.github.com/repos/yahoo/bullet-storm/branches{/branch}","tags_url":"https://api.github.com/repos/yahoo/bullet-storm/tags","blobs_url":"https://api.github.com/repos/yahoo/bullet-storm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yahoo/bullet-storm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yahoo/bullet-storm/git/refs{/sha}","trees_url":"https://api.github.com/repos/yahoo/bullet-storm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yahoo/bullet-storm/statuses/{sha}","languages_url":"https://api.github.com/repos/yahoo/bullet-storm/languages","stargazers_url":"https://api.github.com/repos/yahoo/bullet-storm/stargazers","contributors_url":"https://api.github.com/repos/yahoo/bullet-storm/contributors","subscribers_url":"https://api.github.com/repos/yahoo/bullet-storm/subscribers","subscription_url":"https://api.github.com/repos/yahoo/bullet-storm/subscription","commits_url":"https://api.github.com/repos/yahoo/bullet-storm/commits{/sha}","git_commits_url":"https://api.github.com/repos/yahoo/bullet-storm/git/commits{/sha}","comments_url":"https://api.github.com/repos/yahoo/bullet-storm/comments{/number}","issue_comment_url":"https://api.github.com/repos/yahoo/bullet-storm/issues/comments{/number}","contents_url":"https://api.github.com/repos/yahoo/bullet-storm/contents/{+path}","compare_url":"https://api.github.com/repos/yahoo/bullet-storm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yahoo/bullet-storm/merges","archive_url":"https://api.github.com/repos/yahoo/bullet-storm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yahoo/bullet-storm/downloads","issues_url":"https://api.github.com/repos/yahoo/bullet-storm/issues{/number}","pulls_url":"https://api.github.com/repos/yahoo/bullet-storm/pulls{/number}","milestones_url":"https://api.github.com/repos/yahoo/bullet-storm/milestones{/number}","notifications_url":"https://api.github.com/repos/yahoo/bullet-storm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yahoo/bullet-storm/labels{/name}","releases_url":"https://api.github.com/repos/yahoo/bullet-storm/releases{/id}","deployments_url":"https://api.github.com/repos/yahoo/bullet-storm/deployments","created_at":"2016-11-12T00:28:41Z","updated_at":"2017-01-01T02:55:30Z","pushed_at":"2017-01-24T01:19:55Z","git_url":"git://github.com/yahoo/bullet-storm.git","ssh_url":"git@github.com:yahoo/bullet-storm.git","clone_url":"https://github.com/yahoo/bullet-storm.git","svn_url":"https://github.com/yahoo/bullet-storm","homepage":null,"size":260,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":2,"default_branch":"master"}},"base":{"label":"yahoo:master","ref":"master","sha":"352b1d0ffdfe6dc1a801283f8fbe9b0495a80b3a","user":{"login":"yahoo","id":16574,"avatar_url":"https://avatars.githubusercontent.com/u/16574?v=3","gravatar_id":"","url":"https://api.github.com/users/yahoo","html_url":"https://github.com/yahoo","followers_url":"https://api.github.com/users/yahoo/followers","following_url":"https://api.github.com/users/yahoo/following{/other_user}","gists_url":"https://api.github.com/users/yahoo/gists{/gist_id}","starred_url":"https://api.github.com/users/yahoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yahoo/subscriptions","organizations_url":"https://api.github.com/users/yahoo/orgs","repos_url":"https://api.github.com/users/yahoo/repos","events_url":"https://api.github.com/users/yahoo/events{/privacy}","received_events_url":"https://api.github.com/users/yahoo/received_events","type":"Organization","site_admin":false},"repo":{"id":73521865,"name":"bullet-storm","full_name":"yahoo/bullet-storm","owner":{"login":"yahoo","id":16574,"avatar_url":"https://avatars.githubusercontent.com/u/16574?v=3","gravatar_id":"","url":"https://api.github.com/users/yahoo","html_url":"https://github.com/yahoo","followers_url":"https://api.github.com/users/yahoo/followers","following_url":"https://api.github.com/users/yahoo/following{/other_user}","gists_url":"https://api.github.com/users/yahoo/gists{/gist_id}","starred_url":"https://api.github.com/users/yahoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yahoo/subscriptions","organizations_url":"https://api.github.com/users/yahoo/orgs","repos_url":"https://api.github.com/users/yahoo/repos","events_url":"https://api.github.com/users/yahoo/events{/privacy}","received_events_url":"https://api.github.com/users/yahoo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yahoo/bullet-storm","description":null,"fork":false,"url":"https://api.github.com/repos/yahoo/bullet-storm","forks_url":"https://api.github.com/repos/yahoo/bullet-storm/forks","keys_url":"https://api.github.com/repos/yahoo/bullet-storm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yahoo/bullet-storm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yahoo/bullet-storm/teams","hooks_url":"https://api.github.com/repos/yahoo/bullet-storm/hooks","issue_events_url":"https://api.github.com/repos/yahoo/bullet-storm/issues/events{/number}","events_url":"https://api.github.com/repos/yahoo/bullet-storm/events","assignees_url":"https://api.github.com/repos/yahoo/bullet-storm/assignees{/user}","branches_url":"https://api.github.com/repos/yahoo/bullet-storm/branches{/branch}","tags_url":"https://api.github.com/repos/yahoo/bullet-storm/tags","blobs_url":"https://api.github.com/repos/yahoo/bullet-storm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yahoo/bullet-storm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yahoo/bullet-storm/git/refs{/sha}","trees_url":"https://api.github.com/repos/yahoo/bullet-storm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yahoo/bullet-storm/statuses/{sha}","languages_url":"https://api.github.com/repos/yahoo/bullet-storm/languages","stargazers_url":"https://api.github.com/repos/yahoo/bullet-storm/stargazers","contributors_url":"https://api.github.com/repos/yahoo/bullet-storm/contributors","subscribers_url":"https://api.github.com/repos/yahoo/bullet-storm/subscribers","subscription_url":"https://api.github.com/repos/yahoo/bullet-storm/subscription","commits_url":"https://api.github.com/repos/yahoo/bullet-storm/commits{/sha}","git_commits_url":"https://api.github.com/repos/yahoo/bullet-storm/git/commits{/sha}","comments_url":"https://api.github.com/repos/yahoo/bullet-storm/comments{/number}","issue_comment_url":"https://api.github.com/repos/yahoo/bullet-storm/issues/comments{/number}","contents_url":"https://api.github.com/repos/yahoo/bullet-storm/contents/{+path}","compare_url":"https://api.github.com/repos/yahoo/bullet-storm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yahoo/bullet-storm/merges","archive_url":"https://api.github.com/repos/yahoo/bullet-storm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yahoo/bullet-storm/downloads","issues_url":"https://api.github.com/repos/yahoo/bullet-storm/issues{/number}","pulls_url":"https://api.github.com/repos/yahoo/bullet-storm/pulls{/number}","milestones_url":"https://api.github.com/repos/yahoo/bullet-storm/milestones{/number}","notifications_url":"https://api.github.com/repos/yahoo/bullet-storm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yahoo/bullet-storm/labels{/name}","releases_url":"https://api.github.com/repos/yahoo/bullet-storm/releases{/id}","deployments_url":"https://api.github.com/repos/yahoo/bullet-storm/deployments","created_at":"2016-11-12T00:28:41Z","updated_at":"2017-01-01T02:55:30Z","pushed_at":"2017-01-24T01:19:55Z","git_url":"git://github.com/yahoo/bullet-storm.git","ssh_url":"git@github.com:yahoo/bullet-storm.git","clone_url":"https://github.com/yahoo/bullet-storm.git","svn_url":"https://github.com/yahoo/bullet-storm","homepage":null,"size":260,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yahoo/bullet-storm/pulls/8"},"html":{"href":"https://github.com/yahoo/bullet-storm/pull/8"},"issue":{"href":"https://api.github.com/repos/yahoo/bullet-storm/issues/8"},"comments":{"href":"https://api.github.com/repos/yahoo/bullet-storm/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/yahoo/bullet-storm/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/yahoo/bullet-storm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yahoo/bullet-storm/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/yahoo/bullet-storm/statuses/98fa41f520c1471ecb038668f13b545c77c7c285"}}}}
{"actor":{"display_login":"NathanSpeidel"}}