{"action":"created","comment":{"url":"https://api.github.com/repos/rackerlabs/blueflood/pulls/comments/40869507","id":40869507,"diff_hunk":"@@ -41,6 +41,16 @@ public int getCount() {\n         return hashedEnumValues2Count.size();\n     }\n \n+    public int getNumPoints() {\n+        int enumCount = 0;\n+        Set keySet = hashedEnumValues2Count.keySet();\n+        Iterator itr = keySet.iterator();\n+        while(itr.hasNext()){\n+            enumCount+= hashedEnumValues2Count.get(itr.next());\n+        }","path":"blueflood-core/src/main/java/com/rackspacecloud/blueflood/types/BluefloodEnumRollup.java","position":10,"original_position":10,"commit_id":"c24259fa3a28d0f4ae82955af8f86e13cee6c2fc","original_commit_id":"c24259fa3a28d0f4ae82955af8f86e13cee6c2fc","user":{"login":"GeorgeJahad","id":86830,"avatar_url":"https://avatars.githubusercontent.com/u/86830?v=3","gravatar_id":"","url":"https://api.github.com/users/GeorgeJahad","html_url":"https://github.com/GeorgeJahad","followers_url":"https://api.github.com/users/GeorgeJahad/followers","following_url":"https://api.github.com/users/GeorgeJahad/following{/other_user}","gists_url":"https://api.github.com/users/GeorgeJahad/gists{/gist_id}","starred_url":"https://api.github.com/users/GeorgeJahad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GeorgeJahad/subscriptions","organizations_url":"https://api.github.com/users/GeorgeJahad/orgs","repos_url":"https://api.github.com/users/GeorgeJahad/repos","events_url":"https://api.github.com/users/GeorgeJahad/events{/privacy}","received_events_url":"https://api.github.com/users/GeorgeJahad/received_events","type":"User","site_admin":false},"body":"\r\nwouldn't it be clearer to iterate through the values with the foreach syntax, something like this:\r\nfor (Long value: hashedEnumValues2Count.values()):\r\n    enumCount += value;\r\n","created_at":"2015-10-01T00:34:56Z","updated_at":"2015-10-01T00:34:56Z","html_url":"https://github.com/rackerlabs/blueflood/pull/527#discussion_r40869507","pull_request_url":"https://api.github.com/repos/rackerlabs/blueflood/pulls/527","_links":{"self":{"href":"https://api.github.com/repos/rackerlabs/blueflood/pulls/comments/40869507"},"html":{"href":"https://github.com/rackerlabs/blueflood/pull/527#discussion_r40869507"},"pull_request":{"href":"https://api.github.com/repos/rackerlabs/blueflood/pulls/527"}}},"pull_request":{"url":"https://api.github.com/repos/rackerlabs/blueflood/pulls/527","id":46063698,"html_url":"https://github.com/rackerlabs/blueflood/pull/527","diff_url":"https://github.com/rackerlabs/blueflood/pull/527.diff","patch_url":"https://github.com/rackerlabs/blueflood/pull/527.patch","issue_url":"https://api.github.com/repos/rackerlabs/blueflood/issues/527","number":527,"state":"open","locked":false,"title":"WIP: Adding queries for enums","user":{"login":"tilogaat","id":8238570,"avatar_url":"https://avatars.githubusercontent.com/u/8238570?v=3","gravatar_id":"","url":"https://api.github.com/users/tilogaat","html_url":"https://github.com/tilogaat","followers_url":"https://api.github.com/users/tilogaat/followers","following_url":"https://api.github.com/users/tilogaat/following{/other_user}","gists_url":"https://api.github.com/users/tilogaat/gists{/gist_id}","starred_url":"https://api.github.com/users/tilogaat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tilogaat/subscriptions","organizations_url":"https://api.github.com/users/tilogaat/orgs","repos_url":"https://api.github.com/users/tilogaat/repos","events_url":"https://api.github.com/users/tilogaat/events{/privacy}","received_events_url":"https://api.github.com/users/tilogaat/received_events","type":"User","site_admin":false},"body":"What:\r\nAdding query features for enums. The query and result that will be supported by this PR are:\r\n```\r\ncurl -XGET 'localhost:20000/v2.0/99988877/views/call_xyz_api?from=1443231812000&to=1443231814000&points=200'\r\n\r\n{\r\n  \"unit\": \"unknown\",\r\n  \"values\": [\r\n    {\r\n      \"numPoints\": 5,\r\n      \"timestamp\": 1439229600000,\r\n      \"enum_values\": {\r\n        \"OK\": 3,\r\n        \"ERROR\": 2\r\n      }\r\n    }\r\n  ],\r\n  \"metadata\": {\r\n    \"limit\": null,\r\n    \"next_href\": null,\r\n    \"count\": 1,\r\n    \"marker\": null\r\n  }\r\n}\r\n```\r\n\r\nHow:\r\nThe crux of this PR is in AstyanaxReader. All others are wiring changes. \r\nmetrics_enum CF holds the raw string values mapped to the hashcodes. In rollups, we only use hashcodes for rollups. At the time of the query, we need to map these hashcodes with the actual raw strings. In AstyanaxReader a threadpool will retrieve enum values from metrics_enum CF, simultaneously it will retrieve the actual points from metrics_pre-aggregated_full (or the corresponding CFs for rollups). It will create a relational join using the string and hash values. The end result for the query will be obtained from stringEnumValues2Count datastructure in BluefloodEnumRollup class. \r\n\r\nTodo:\r\n1. ~~Support query of enums using batches of locators.~~\r\n2. ~~More end-to-end integration tests for queries~~\r\n3. Tests for retrieving enum rollup data for enums at each granularity\r\n\r\n\r\n\r\n\r\n\r\n\r\n","created_at":"2015-09-25T22:12:06Z","updated_at":"2015-10-01T00:34:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"950a99c5203c06a0234f32614ea1835ca4840246","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rackerlabs/blueflood/pulls/527/commits","review_comments_url":"https://api.github.com/repos/rackerlabs/blueflood/pulls/527/comments","review_comment_url":"https://api.github.com/repos/rackerlabs/blueflood/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rackerlabs/blueflood/issues/527/comments","statuses_url":"https://api.github.com/repos/rackerlabs/blueflood/statuses/c24259fa3a28d0f4ae82955af8f86e13cee6c2fc","head":{"label":"tilogaat:gauravquery","ref":"gauravquery","sha":"c24259fa3a28d0f4ae82955af8f86e13cee6c2fc","user":{"login":"tilogaat","id":8238570,"avatar_url":"https://avatars.githubusercontent.com/u/8238570?v=3","gravatar_id":"","url":"https://api.github.com/users/tilogaat","html_url":"https://github.com/tilogaat","followers_url":"https://api.github.com/users/tilogaat/followers","following_url":"https://api.github.com/users/tilogaat/following{/other_user}","gists_url":"https://api.github.com/users/tilogaat/gists{/gist_id}","starred_url":"https://api.github.com/users/tilogaat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tilogaat/subscriptions","organizations_url":"https://api.github.com/users/tilogaat/orgs","repos_url":"https://api.github.com/users/tilogaat/repos","events_url":"https://api.github.com/users/tilogaat/events{/privacy}","received_events_url":"https://api.github.com/users/tilogaat/received_events","type":"User","site_admin":false},"repo":{"id":22357256,"name":"blueflood","full_name":"tilogaat/blueflood","owner":{"login":"tilogaat","id":8238570,"avatar_url":"https://avatars.githubusercontent.com/u/8238570?v=3","gravatar_id":"","url":"https://api.github.com/users/tilogaat","html_url":"https://github.com/tilogaat","followers_url":"https://api.github.com/users/tilogaat/followers","following_url":"https://api.github.com/users/tilogaat/following{/other_user}","gists_url":"https://api.github.com/users/tilogaat/gists{/gist_id}","starred_url":"https://api.github.com/users/tilogaat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tilogaat/subscriptions","organizations_url":"https://api.github.com/users/tilogaat/orgs","repos_url":"https://api.github.com/users/tilogaat/repos","events_url":"https://api.github.com/users/tilogaat/events{/privacy}","received_events_url":"https://api.github.com/users/tilogaat/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tilogaat/blueflood","description":"A distributed system designed to ingest and process time series data","fork":true,"url":"https://api.github.com/repos/tilogaat/blueflood","forks_url":"https://api.github.com/repos/tilogaat/blueflood/forks","keys_url":"https://api.github.com/repos/tilogaat/blueflood/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tilogaat/blueflood/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tilogaat/blueflood/teams","hooks_url":"https://api.github.com/repos/tilogaat/blueflood/hooks","issue_events_url":"https://api.github.com/repos/tilogaat/blueflood/issues/events{/number}","events_url":"https://api.github.com/repos/tilogaat/blueflood/events","assignees_url":"https://api.github.com/repos/tilogaat/blueflood/assignees{/user}","branches_url":"https://api.github.com/repos/tilogaat/blueflood/branches{/branch}","tags_url":"https://api.github.com/repos/tilogaat/blueflood/tags","blobs_url":"https://api.github.com/repos/tilogaat/blueflood/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tilogaat/blueflood/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tilogaat/blueflood/git/refs{/sha}","trees_url":"https://api.github.com/repos/tilogaat/blueflood/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tilogaat/blueflood/statuses/{sha}","languages_url":"https://api.github.com/repos/tilogaat/blueflood/languages","stargazers_url":"https://api.github.com/repos/tilogaat/blueflood/stargazers","contributors_url":"https://api.github.com/repos/tilogaat/blueflood/contributors","subscribers_url":"https://api.github.com/repos/tilogaat/blueflood/subscribers","subscription_url":"https://api.github.com/repos/tilogaat/blueflood/subscription","commits_url":"https://api.github.com/repos/tilogaat/blueflood/commits{/sha}","git_commits_url":"https://api.github.com/repos/tilogaat/blueflood/git/commits{/sha}","comments_url":"https://api.github.com/repos/tilogaat/blueflood/comments{/number}","issue_comment_url":"https://api.github.com/repos/tilogaat/blueflood/issues/comments{/number}","contents_url":"https://api.github.com/repos/tilogaat/blueflood/contents/{+path}","compare_url":"https://api.github.com/repos/tilogaat/blueflood/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tilogaat/blueflood/merges","archive_url":"https://api.github.com/repos/tilogaat/blueflood/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tilogaat/blueflood/downloads","issues_url":"https://api.github.com/repos/tilogaat/blueflood/issues{/number}","pulls_url":"https://api.github.com/repos/tilogaat/blueflood/pulls{/number}","milestones_url":"https://api.github.com/repos/tilogaat/blueflood/milestones{/number}","notifications_url":"https://api.github.com/repos/tilogaat/blueflood/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tilogaat/blueflood/labels{/name}","releases_url":"https://api.github.com/repos/tilogaat/blueflood/releases{/id}","created_at":"2014-07-28T20:44:27Z","updated_at":"2014-07-28T21:21:07Z","pushed_at":"2015-09-29T23:04:34Z","git_url":"git://github.com/tilogaat/blueflood.git","ssh_url":"git@github.com:tilogaat/blueflood.git","clone_url":"https://github.com/tilogaat/blueflood.git","svn_url":"https://github.com/tilogaat/blueflood","homepage":"http://www.blueflood.io","size":5576,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"rackerlabs:enums-feature","ref":"enums-feature","sha":"a159ff010a7358150f35de7752f50c82ec9096a2","user":{"login":"rackerlabs","id":84293,"avatar_url":"https://avatars.githubusercontent.com/u/84293?v=3","gravatar_id":"","url":"https://api.github.com/users/rackerlabs","html_url":"https://github.com/rackerlabs","followers_url":"https://api.github.com/users/rackerlabs/followers","following_url":"https://api.github.com/users/rackerlabs/following{/other_user}","gists_url":"https://api.github.com/users/rackerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rackerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackerlabs/subscriptions","organizations_url":"https://api.github.com/users/rackerlabs/orgs","repos_url":"https://api.github.com/users/rackerlabs/repos","events_url":"https://api.github.com/users/rackerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rackerlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":10081109,"name":"blueflood","full_name":"rackerlabs/blueflood","owner":{"login":"rackerlabs","id":84293,"avatar_url":"https://avatars.githubusercontent.com/u/84293?v=3","gravatar_id":"","url":"https://api.github.com/users/rackerlabs","html_url":"https://github.com/rackerlabs","followers_url":"https://api.github.com/users/rackerlabs/followers","following_url":"https://api.github.com/users/rackerlabs/following{/other_user}","gists_url":"https://api.github.com/users/rackerlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/rackerlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rackerlabs/subscriptions","organizations_url":"https://api.github.com/users/rackerlabs/orgs","repos_url":"https://api.github.com/users/rackerlabs/repos","events_url":"https://api.github.com/users/rackerlabs/events{/privacy}","received_events_url":"https://api.github.com/users/rackerlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rackerlabs/blueflood","description":"A distributed system designed to ingest and process time series data","fork":false,"url":"https://api.github.com/repos/rackerlabs/blueflood","forks_url":"https://api.github.com/repos/rackerlabs/blueflood/forks","keys_url":"https://api.github.com/repos/rackerlabs/blueflood/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rackerlabs/blueflood/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rackerlabs/blueflood/teams","hooks_url":"https://api.github.com/repos/rackerlabs/blueflood/hooks","issue_events_url":"https://api.github.com/repos/rackerlabs/blueflood/issues/events{/number}","events_url":"https://api.github.com/repos/rackerlabs/blueflood/events","assignees_url":"https://api.github.com/repos/rackerlabs/blueflood/assignees{/user}","branches_url":"https://api.github.com/repos/rackerlabs/blueflood/branches{/branch}","tags_url":"https://api.github.com/repos/rackerlabs/blueflood/tags","blobs_url":"https://api.github.com/repos/rackerlabs/blueflood/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rackerlabs/blueflood/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rackerlabs/blueflood/git/refs{/sha}","trees_url":"https://api.github.com/repos/rackerlabs/blueflood/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rackerlabs/blueflood/statuses/{sha}","languages_url":"https://api.github.com/repos/rackerlabs/blueflood/languages","stargazers_url":"https://api.github.com/repos/rackerlabs/blueflood/stargazers","contributors_url":"https://api.github.com/repos/rackerlabs/blueflood/contributors","subscribers_url":"https://api.github.com/repos/rackerlabs/blueflood/subscribers","subscription_url":"https://api.github.com/repos/rackerlabs/blueflood/subscription","commits_url":"https://api.github.com/repos/rackerlabs/blueflood/commits{/sha}","git_commits_url":"https://api.github.com/repos/rackerlabs/blueflood/git/commits{/sha}","comments_url":"https://api.github.com/repos/rackerlabs/blueflood/comments{/number}","issue_comment_url":"https://api.github.com/repos/rackerlabs/blueflood/issues/comments{/number}","contents_url":"https://api.github.com/repos/rackerlabs/blueflood/contents/{+path}","compare_url":"https://api.github.com/repos/rackerlabs/blueflood/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rackerlabs/blueflood/merges","archive_url":"https://api.github.com/repos/rackerlabs/blueflood/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rackerlabs/blueflood/downloads","issues_url":"https://api.github.com/repos/rackerlabs/blueflood/issues{/number}","pulls_url":"https://api.github.com/repos/rackerlabs/blueflood/pulls{/number}","milestones_url":"https://api.github.com/repos/rackerlabs/blueflood/milestones{/number}","notifications_url":"https://api.github.com/repos/rackerlabs/blueflood/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rackerlabs/blueflood/labels{/name}","releases_url":"https://api.github.com/repos/rackerlabs/blueflood/releases{/id}","created_at":"2013-05-15T14:50:39Z","updated_at":"2015-09-30T17:44:18Z","pushed_at":"2015-09-30T21:19:33Z","git_url":"git://github.com/rackerlabs/blueflood.git","ssh_url":"git@github.com:rackerlabs/blueflood.git","clone_url":"https://github.com/rackerlabs/blueflood.git","svn_url":"https://github.com/rackerlabs/blueflood","homepage":"http://www.blueflood.io","size":11871,"stargazers_count":370,"watchers_count":370,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":47,"mirror_url":null,"open_issues_count":28,"forks":47,"open_issues":28,"watchers":370,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rackerlabs/blueflood/pulls/527"},"html":{"href":"https://github.com/rackerlabs/blueflood/pull/527"},"issue":{"href":"https://api.github.com/repos/rackerlabs/blueflood/issues/527"},"comments":{"href":"https://api.github.com/repos/rackerlabs/blueflood/issues/527/comments"},"review_comments":{"href":"https://api.github.com/repos/rackerlabs/blueflood/pulls/527/comments"},"review_comment":{"href":"https://api.github.com/repos/rackerlabs/blueflood/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rackerlabs/blueflood/pulls/527/commits"},"statuses":{"href":"https://api.github.com/repos/rackerlabs/blueflood/statuses/c24259fa3a28d0f4ae82955af8f86e13cee6c2fc"}}}}