{"action":"created","comment":{"url":"https://api.github.com/repos/druid-io/druid/pulls/comments/49256674","id":49256674,"diff_hunk":"@@ -244,22 +243,57 @@ public int lookupId(String name)\n     };\n   }\n \n+  public static class DimensionDesc\n+  {\n+    final int index;\n+    final String name;\n+    final DimDim values;\n+    final ColumnCapabilitiesImpl capabilities;\n+\n+    public DimensionDesc(int index, String name, DimDim values, ColumnCapabilitiesImpl capabilities)\n+    {\n+      this.index = index;\n+      this.name = name;\n+      this.values = values;\n+      this.capabilities = capabilities;\n+    }\n+  }\n+\n+  public static class MetricDesc\n+  {\n+    final int index;\n+    final String name;\n+    final String type;\n+    final ColumnCapabilitiesImpl capabilities;\n+\n+    public MetricDesc(int index, AggregatorFactory factory)\n+    {\n+      this.index = index;\n+      this.name = factory.getName();\n+      this.type = factory.getTypeName();\n+      this.capabilities = new ColumnCapabilitiesImpl();\n+      if (type.equalsIgnoreCase(\"float\")) {\n+        capabilities.setType(ValueType.FLOAT);\n+      } else if (type.equalsIgnoreCase(\"long\")) {\n+        capabilities.setType(ValueType.LONG);\n+      } else {\n+        capabilities.setType(ValueType.COMPLEX);\n+      }\n+    }\n+  }\n+\n   private final long minTimestamp;\n   private final QueryGranularity gran;\n   private final List<Function<InputRow, InputRow>> rowTransformers;\n-  private final AggregatorFactory[] metrics;\n-  private final Map<String, Integer> metricIndexes;\n-  private final Map<String, String> metricTypes;\n-  private final ImmutableList<String> metricNames;\n-  private final LinkedHashMap<String, Integer> dimensionOrder;\n+  private final AggregatorFactory[] factories;\n   private final AggregatorType[] aggs;\n-  private final DimensionHolder dimValues;\n-  private final Map<String, ColumnCapabilitiesImpl> columnCapabilities;\n   private final boolean deserializeComplexMetrics;\n \n-  protected final CopyOnWriteArrayList<String> dimensions;\n+  private final Map<String, MetricDesc> metrics;\n+  private final Map<String, DimensionDesc> dimensions;\n+  private final Map<String, ColumnCapabilitiesImpl> columnCapabilities;\n \n-  private volatile AtomicInteger numEntries = new AtomicInteger();\n+  private transient final AtomicInteger numEntries = new AtomicInteger();","path":"processing/src/main/java/io/druid/segment/incremental/IncrementalIndex.java","position":null,"original_position":87,"commit_id":"5d0705b83194ea1d396f396c04544ec5b861767f","original_commit_id":"7b667c8cefc012b8fd7042fb320637f234b4bc57","user":{"login":"jon-wei","id":8729063,"avatar_url":"https://avatars.githubusercontent.com/u/8729063?v=3","gravatar_id":"","url":"https://api.github.com/users/jon-wei","html_url":"https://github.com/jon-wei","followers_url":"https://api.github.com/users/jon-wei/followers","following_url":"https://api.github.com/users/jon-wei/following{/other_user}","gists_url":"https://api.github.com/users/jon-wei/gists{/gist_id}","starred_url":"https://api.github.com/users/jon-wei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jon-wei/subscriptions","organizations_url":"https://api.github.com/users/jon-wei/orgs","repos_url":"https://api.github.com/users/jon-wei/repos","events_url":"https://api.github.com/users/jon-wei/events{/privacy}","received_events_url":"https://api.github.com/users/jon-wei/received_events","type":"User","site_admin":false},"body":"I think removing \"volatile\" there should be okay, seems like AtomicInteger read/writes have the same memory effects as accesses on a volatile variable:\r\n\r\nhttp://docs.oracle.com/javase/7/docs/api/java/util/concurrent/atomic/package-summary.html\r\n","created_at":"2016-01-09T01:08:22Z","updated_at":"2016-01-09T01:08:22Z","html_url":"https://github.com/druid-io/druid/pull/2169#discussion_r49256674","pull_request_url":"https://api.github.com/repos/druid-io/druid/pulls/2169","_links":{"self":{"href":"https://api.github.com/repos/druid-io/druid/pulls/comments/49256674"},"html":{"href":"https://github.com/druid-io/druid/pull/2169#discussion_r49256674"},"pull_request":{"href":"https://api.github.com/repos/druid-io/druid/pulls/2169"}}},"pull_request":{"url":"https://api.github.com/repos/druid-io/druid/pulls/2169","id":54701983,"html_url":"https://github.com/druid-io/druid/pull/2169","diff_url":"https://github.com/druid-io/druid/pull/2169.diff","patch_url":"https://github.com/druid-io/druid/pull/2169.patch","issue_url":"https://api.github.com/repos/druid-io/druid/issues/2169","number":2169,"state":"open","locked":false,"title":"Simplify information in IncrementalIndex","user":{"login":"navis","id":809395,"avatar_url":"https://avatars.githubusercontent.com/u/809395?v=3","gravatar_id":"","url":"https://api.github.com/users/navis","html_url":"https://github.com/navis","followers_url":"https://api.github.com/users/navis/followers","following_url":"https://api.github.com/users/navis/following{/other_user}","gists_url":"https://api.github.com/users/navis/gists{/gist_id}","starred_url":"https://api.github.com/users/navis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/navis/subscriptions","organizations_url":"https://api.github.com/users/navis/orgs","repos_url":"https://api.github.com/users/navis/repos","events_url":"https://api.github.com/users/navis/events{/privacy}","received_events_url":"https://api.github.com/users/navis/received_events","type":"User","site_admin":false},"body":"For\r\n```\r\nprivate final Map<String, Integer> metricIndexes;\r\nprivate final Map<String, String> metricTypes;\r\nprivate final ImmutableList<String> metricNames;\r\n```\r\nand\r\n```\r\nprivate final LinkedHashMap<String, Integer> dimensionOrder;\r\nprivate final DimensionHolder dimValues;\r\nprivate final CopyOnWriteArrayList<String> dimensions;\r\n```\r\neach group can be merged into single map\r\n\r\n","created_at":"2015-12-29T04:42:47Z","updated_at":"2016-01-09T01:08:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dbcfeaa2f3853e95eb36dae1aea1a36580e2917d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/druid-io/druid/pulls/2169/commits","review_comments_url":"https://api.github.com/repos/druid-io/druid/pulls/2169/comments","review_comment_url":"https://api.github.com/repos/druid-io/druid/pulls/comments{/number}","comments_url":"https://api.github.com/repos/druid-io/druid/issues/2169/comments","statuses_url":"https://api.github.com/repos/druid-io/druid/statuses/5d0705b83194ea1d396f396c04544ec5b861767f","head":{"label":"navis:refactor-incremental-index3","ref":"refactor-incremental-index3","sha":"5d0705b83194ea1d396f396c04544ec5b861767f","user":{"login":"navis","id":809395,"avatar_url":"https://avatars.githubusercontent.com/u/809395?v=3","gravatar_id":"","url":"https://api.github.com/users/navis","html_url":"https://github.com/navis","followers_url":"https://api.github.com/users/navis/followers","following_url":"https://api.github.com/users/navis/following{/other_user}","gists_url":"https://api.github.com/users/navis/gists{/gist_id}","starred_url":"https://api.github.com/users/navis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/navis/subscriptions","organizations_url":"https://api.github.com/users/navis/orgs","repos_url":"https://api.github.com/users/navis/repos","events_url":"https://api.github.com/users/navis/events{/privacy}","received_events_url":"https://api.github.com/users/navis/received_events","type":"User","site_admin":false},"repo":{"id":45149930,"name":"druid","full_name":"navis/druid","owner":{"login":"navis","id":809395,"avatar_url":"https://avatars.githubusercontent.com/u/809395?v=3","gravatar_id":"","url":"https://api.github.com/users/navis","html_url":"https://github.com/navis","followers_url":"https://api.github.com/users/navis/followers","following_url":"https://api.github.com/users/navis/following{/other_user}","gists_url":"https://api.github.com/users/navis/gists{/gist_id}","starred_url":"https://api.github.com/users/navis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/navis/subscriptions","organizations_url":"https://api.github.com/users/navis/orgs","repos_url":"https://api.github.com/users/navis/repos","events_url":"https://api.github.com/users/navis/events{/privacy}","received_events_url":"https://api.github.com/users/navis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/navis/druid","description":"Column oriented distributed data store ideal for powering interactive applications","fork":true,"url":"https://api.github.com/repos/navis/druid","forks_url":"https://api.github.com/repos/navis/druid/forks","keys_url":"https://api.github.com/repos/navis/druid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/navis/druid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/navis/druid/teams","hooks_url":"https://api.github.com/repos/navis/druid/hooks","issue_events_url":"https://api.github.com/repos/navis/druid/issues/events{/number}","events_url":"https://api.github.com/repos/navis/druid/events","assignees_url":"https://api.github.com/repos/navis/druid/assignees{/user}","branches_url":"https://api.github.com/repos/navis/druid/branches{/branch}","tags_url":"https://api.github.com/repos/navis/druid/tags","blobs_url":"https://api.github.com/repos/navis/druid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/navis/druid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/navis/druid/git/refs{/sha}","trees_url":"https://api.github.com/repos/navis/druid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/navis/druid/statuses/{sha}","languages_url":"https://api.github.com/repos/navis/druid/languages","stargazers_url":"https://api.github.com/repos/navis/druid/stargazers","contributors_url":"https://api.github.com/repos/navis/druid/contributors","subscribers_url":"https://api.github.com/repos/navis/druid/subscribers","subscription_url":"https://api.github.com/repos/navis/druid/subscription","commits_url":"https://api.github.com/repos/navis/druid/commits{/sha}","git_commits_url":"https://api.github.com/repos/navis/druid/git/commits{/sha}","comments_url":"https://api.github.com/repos/navis/druid/comments{/number}","issue_comment_url":"https://api.github.com/repos/navis/druid/issues/comments{/number}","contents_url":"https://api.github.com/repos/navis/druid/contents/{+path}","compare_url":"https://api.github.com/repos/navis/druid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/navis/druid/merges","archive_url":"https://api.github.com/repos/navis/druid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/navis/druid/downloads","issues_url":"https://api.github.com/repos/navis/druid/issues{/number}","pulls_url":"https://api.github.com/repos/navis/druid/pulls{/number}","milestones_url":"https://api.github.com/repos/navis/druid/milestones{/number}","notifications_url":"https://api.github.com/repos/navis/druid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/navis/druid/labels{/name}","releases_url":"https://api.github.com/repos/navis/druid/releases{/id}","created_at":"2015-10-29T00:22:35Z","updated_at":"2015-10-29T00:22:47Z","pushed_at":"2016-01-08T01:39:27Z","git_url":"git://github.com/navis/druid.git","ssh_url":"git@github.com:navis/druid.git","clone_url":"https://github.com/navis/druid.git","svn_url":"https://github.com/navis/druid","homepage":"http://druid.io","size":99633,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"druid-io:master","ref":"master","sha":"863d84e30e91876a04d25958b086802c7071281b","user":{"login":"druid-io","id":4203474,"avatar_url":"https://avatars.githubusercontent.com/u/4203474?v=3","gravatar_id":"","url":"https://api.github.com/users/druid-io","html_url":"https://github.com/druid-io","followers_url":"https://api.github.com/users/druid-io/followers","following_url":"https://api.github.com/users/druid-io/following{/other_user}","gists_url":"https://api.github.com/users/druid-io/gists{/gist_id}","starred_url":"https://api.github.com/users/druid-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/druid-io/subscriptions","organizations_url":"https://api.github.com/users/druid-io/orgs","repos_url":"https://api.github.com/users/druid-io/repos","events_url":"https://api.github.com/users/druid-io/events{/privacy}","received_events_url":"https://api.github.com/users/druid-io/received_events","type":"Organization","site_admin":false},"repo":{"id":6358188,"name":"druid","full_name":"druid-io/druid","owner":{"login":"druid-io","id":4203474,"avatar_url":"https://avatars.githubusercontent.com/u/4203474?v=3","gravatar_id":"","url":"https://api.github.com/users/druid-io","html_url":"https://github.com/druid-io","followers_url":"https://api.github.com/users/druid-io/followers","following_url":"https://api.github.com/users/druid-io/following{/other_user}","gists_url":"https://api.github.com/users/druid-io/gists{/gist_id}","starred_url":"https://api.github.com/users/druid-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/druid-io/subscriptions","organizations_url":"https://api.github.com/users/druid-io/orgs","repos_url":"https://api.github.com/users/druid-io/repos","events_url":"https://api.github.com/users/druid-io/events{/privacy}","received_events_url":"https://api.github.com/users/druid-io/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/druid-io/druid","description":"Column oriented distributed data store ideal for powering interactive applications","fork":false,"url":"https://api.github.com/repos/druid-io/druid","forks_url":"https://api.github.com/repos/druid-io/druid/forks","keys_url":"https://api.github.com/repos/druid-io/druid/keys{/key_id}","collaborators_url":"https://api.github.com/repos/druid-io/druid/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/druid-io/druid/teams","hooks_url":"https://api.github.com/repos/druid-io/druid/hooks","issue_events_url":"https://api.github.com/repos/druid-io/druid/issues/events{/number}","events_url":"https://api.github.com/repos/druid-io/druid/events","assignees_url":"https://api.github.com/repos/druid-io/druid/assignees{/user}","branches_url":"https://api.github.com/repos/druid-io/druid/branches{/branch}","tags_url":"https://api.github.com/repos/druid-io/druid/tags","blobs_url":"https://api.github.com/repos/druid-io/druid/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/druid-io/druid/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/druid-io/druid/git/refs{/sha}","trees_url":"https://api.github.com/repos/druid-io/druid/git/trees{/sha}","statuses_url":"https://api.github.com/repos/druid-io/druid/statuses/{sha}","languages_url":"https://api.github.com/repos/druid-io/druid/languages","stargazers_url":"https://api.github.com/repos/druid-io/druid/stargazers","contributors_url":"https://api.github.com/repos/druid-io/druid/contributors","subscribers_url":"https://api.github.com/repos/druid-io/druid/subscribers","subscription_url":"https://api.github.com/repos/druid-io/druid/subscription","commits_url":"https://api.github.com/repos/druid-io/druid/commits{/sha}","git_commits_url":"https://api.github.com/repos/druid-io/druid/git/commits{/sha}","comments_url":"https://api.github.com/repos/druid-io/druid/comments{/number}","issue_comment_url":"https://api.github.com/repos/druid-io/druid/issues/comments{/number}","contents_url":"https://api.github.com/repos/druid-io/druid/contents/{+path}","compare_url":"https://api.github.com/repos/druid-io/druid/compare/{base}...{head}","merges_url":"https://api.github.com/repos/druid-io/druid/merges","archive_url":"https://api.github.com/repos/druid-io/druid/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/druid-io/druid/downloads","issues_url":"https://api.github.com/repos/druid-io/druid/issues{/number}","pulls_url":"https://api.github.com/repos/druid-io/druid/pulls{/number}","milestones_url":"https://api.github.com/repos/druid-io/druid/milestones{/number}","notifications_url":"https://api.github.com/repos/druid-io/druid/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/druid-io/druid/labels{/name}","releases_url":"https://api.github.com/repos/druid-io/druid/releases{/id}","created_at":"2012-10-23T19:08:07Z","updated_at":"2016-01-08T20:41:47Z","pushed_at":"2016-01-08T20:40:14Z","git_url":"git://github.com/druid-io/druid.git","ssh_url":"git@github.com:druid-io/druid.git","clone_url":"https://github.com/druid-io/druid.git","svn_url":"https://github.com/druid-io/druid","homepage":"http://druid.io","size":121572,"stargazers_count":2335,"watchers_count":2335,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":548,"mirror_url":null,"open_issues_count":276,"forks":548,"open_issues":276,"watchers":2335,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/druid-io/druid/pulls/2169"},"html":{"href":"https://github.com/druid-io/druid/pull/2169"},"issue":{"href":"https://api.github.com/repos/druid-io/druid/issues/2169"},"comments":{"href":"https://api.github.com/repos/druid-io/druid/issues/2169/comments"},"review_comments":{"href":"https://api.github.com/repos/druid-io/druid/pulls/2169/comments"},"review_comment":{"href":"https://api.github.com/repos/druid-io/druid/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/druid-io/druid/pulls/2169/commits"},"statuses":{"href":"https://api.github.com/repos/druid-io/druid/statuses/5d0705b83194ea1d396f396c04544ec5b861767f"}}}}