{"action":"created","comment":{"url":"https://api.github.com/repos/apache/incubator-carbondata/pulls/comments/80179086","id":80179086,"diff_hunk":"@@ -0,0 +1,172 @@\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.carbondata.core.carbon.querystatistics;\n+\n+import java.io.Serializable;\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+import org.apache.carbondata.common.logging.LogService;\n+import org.apache.carbondata.common.logging.LogServiceFactory;\n+\n+import static org.apache.carbondata.core.util.CarbonUtil.printLine;\n+\n+/**\n+ * Class will be used to record and log the query statistics\n+ */\n+public class QueryStatisticsRecorderImpl implements QueryStatisticsRecorder,Serializable {\n+\n+  private static final LogService LOGGER =\n+      LogServiceFactory.getLogService(QueryStatisticsRecorderImpl.class.getName());\n+\n+  /**\n+   * serialization version\n+   */\n+  private static final long serialVersionUID = -5719752001674467864L;\n+\n+  /**\n+   * list for statistics to record time taken\n+   * by each phase of the query for example aggregation\n+   * scanning,block loading time etc.\n+   */\n+  private List<QueryStatistic> queryStatistics;\n+\n+  /**\n+   * query with taskd\n+   */\n+  private String queryIWthTask;\n+\n+  /**\n+   * lock for log statistics table\n+   */\n+  private static final Object lock = new Object();\n+\n+  public QueryStatisticsRecorderImpl(String queryId) {\n+    queryStatistics = new ArrayList<QueryStatistic>();\n+    this.queryIWthTask = queryId;\n+  }\n+\n+  /**\n+   * Below method will be used to add the statistics\n+   *\n+   * @param statistic\n+   */\n+  public synchronized void recordStatistics(QueryStatistic statistic) {\n+    queryStatistics.add(statistic);\n+  }\n+\n+  /**\n+   * Below method will be used to log the statistic\n+   */\n+  public void logStatistics() {\n+    for (QueryStatistic statistic : queryStatistics) {\n+      LOGGER.statistic(statistic.getStatistics(queryIWthTask));\n+    }\n+  }\n+\n+  /**\n+   * Below method will be used to show statistic log as table\n+   */\n+  public void logStatisticsAsTableExecutor() {\n+    synchronized (lock) {","path":"core/src/main/java/org/apache/carbondata/core/carbon/querystatistics/QueryStatisticsRecorderImpl.java","position":87,"original_position":87,"commit_id":"38ba878d9eae3c256c9de113e8602785a7fc8104","original_commit_id":"38ba878d9eae3c256c9de113e8602785a7fc8104","user":{"login":"jackylk","id":6500698,"avatar_url":"https://avatars.githubusercontent.com/u/6500698?v=3","gravatar_id":"","url":"https://api.github.com/users/jackylk","html_url":"https://github.com/jackylk","followers_url":"https://api.github.com/users/jackylk/followers","following_url":"https://api.github.com/users/jackylk/following{/other_user}","gists_url":"https://api.github.com/users/jackylk/gists{/gist_id}","starred_url":"https://api.github.com/users/jackylk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jackylk/subscriptions","organizations_url":"https://api.github.com/users/jackylk/orgs","repos_url":"https://api.github.com/users/jackylk/repos","events_url":"https://api.github.com/users/jackylk/events{/privacy}","received_events_url":"https://api.github.com/users/jackylk/received_events","type":"User","site_admin":false},"body":"Why this lock is required? It seems this is the only place lock is used?","created_at":"2016-09-23T04:07:19Z","updated_at":"2016-09-23T04:19:06Z","html_url":"https://github.com/apache/incubator-carbondata/pull/176#discussion_r80179086","pull_request_url":"https://api.github.com/repos/apache/incubator-carbondata/pulls/176","_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-carbondata/pulls/comments/80179086"},"html":{"href":"https://github.com/apache/incubator-carbondata/pull/176#discussion_r80179086"},"pull_request":{"href":"https://api.github.com/repos/apache/incubator-carbondata/pulls/176"}}},"pull_request":{"url":"https://api.github.com/repos/apache/incubator-carbondata/pulls/176","id":85895672,"html_url":"https://github.com/apache/incubator-carbondata/pull/176","diff_url":"https://github.com/apache/incubator-carbondata/pull/176.diff","patch_url":"https://github.com/apache/incubator-carbondata/pull/176.patch","issue_url":"https://api.github.com/repos/apache/incubator-carbondata/issues/176","number":176,"state":"open","locked":false,"title":"[CARBONDATA-208] Add configuration enbale query statistics on-off","user":{"login":"foryou2030","id":13846940,"avatar_url":"https://avatars.githubusercontent.com/u/13846940?v=3","gravatar_id":"","url":"https://api.github.com/users/foryou2030","html_url":"https://github.com/foryou2030","followers_url":"https://api.github.com/users/foryou2030/followers","following_url":"https://api.github.com/users/foryou2030/following{/other_user}","gists_url":"https://api.github.com/users/foryou2030/gists{/gist_id}","starred_url":"https://api.github.com/users/foryou2030/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foryou2030/subscriptions","organizations_url":"https://api.github.com/users/foryou2030/orgs","repos_url":"https://api.github.com/users/foryou2030/repos","events_url":"https://api.github.com/users/foryou2030/events{/privacy}","received_events_url":"https://api.github.com/users/foryou2030/received_events","type":"User","site_admin":false},"body":"# Why raise this pr?\r\nCurrently there are many STATISTIC log for performance tuning purpose, but it should be configurable by the user.\r\n# How to solve it?\r\nAdd configuration to carbon.properties, \"enable.query.statistics\" (default value is \"false\")\r\nUser can enable query statistics by setting it as true.\r\n\r\n","created_at":"2016-09-20T01:07:18Z","updated_at":"2016-09-23T04:19:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6b02c2295f72b439e223d084459956094ec84448","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/incubator-carbondata/pulls/176/commits","review_comments_url":"https://api.github.com/repos/apache/incubator-carbondata/pulls/176/comments","review_comment_url":"https://api.github.com/repos/apache/incubator-carbondata/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/incubator-carbondata/issues/176/comments","statuses_url":"https://api.github.com/repos/apache/incubator-carbondata/statuses/38ba878d9eae3c256c9de113e8602785a7fc8104","head":{"label":"foryou2030:statistic_switch","ref":"statistic_switch","sha":"38ba878d9eae3c256c9de113e8602785a7fc8104","user":{"login":"foryou2030","id":13846940,"avatar_url":"https://avatars.githubusercontent.com/u/13846940?v=3","gravatar_id":"","url":"https://api.github.com/users/foryou2030","html_url":"https://github.com/foryou2030","followers_url":"https://api.github.com/users/foryou2030/followers","following_url":"https://api.github.com/users/foryou2030/following{/other_user}","gists_url":"https://api.github.com/users/foryou2030/gists{/gist_id}","starred_url":"https://api.github.com/users/foryou2030/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foryou2030/subscriptions","organizations_url":"https://api.github.com/users/foryou2030/orgs","repos_url":"https://api.github.com/users/foryou2030/repos","events_url":"https://api.github.com/users/foryou2030/events{/privacy}","received_events_url":"https://api.github.com/users/foryou2030/received_events","type":"User","site_admin":false},"repo":{"id":62351495,"name":"incubator-carbondata","full_name":"foryou2030/incubator-carbondata","owner":{"login":"foryou2030","id":13846940,"avatar_url":"https://avatars.githubusercontent.com/u/13846940?v=3","gravatar_id":"","url":"https://api.github.com/users/foryou2030","html_url":"https://github.com/foryou2030","followers_url":"https://api.github.com/users/foryou2030/followers","following_url":"https://api.github.com/users/foryou2030/following{/other_user}","gists_url":"https://api.github.com/users/foryou2030/gists{/gist_id}","starred_url":"https://api.github.com/users/foryou2030/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foryou2030/subscriptions","organizations_url":"https://api.github.com/users/foryou2030/orgs","repos_url":"https://api.github.com/users/foryou2030/repos","events_url":"https://api.github.com/users/foryou2030/events{/privacy}","received_events_url":"https://api.github.com/users/foryou2030/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/foryou2030/incubator-carbondata","description":"Mirror of Apache CarbonData (Incubating)","fork":true,"url":"https://api.github.com/repos/foryou2030/incubator-carbondata","forks_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/forks","keys_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/teams","hooks_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/hooks","issue_events_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/issues/events{/number}","events_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/events","assignees_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/assignees{/user}","branches_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/branches{/branch}","tags_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/tags","blobs_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/git/refs{/sha}","trees_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/statuses/{sha}","languages_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/languages","stargazers_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/stargazers","contributors_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/contributors","subscribers_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/subscribers","subscription_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/subscription","commits_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/commits{/sha}","git_commits_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/git/commits{/sha}","comments_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/comments{/number}","issue_comment_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/issues/comments{/number}","contents_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/contents/{+path}","compare_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/merges","archive_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/downloads","issues_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/issues{/number}","pulls_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/pulls{/number}","milestones_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/milestones{/number}","notifications_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/labels{/name}","releases_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/releases{/id}","deployments_url":"https://api.github.com/repos/foryou2030/incubator-carbondata/deployments","created_at":"2016-07-01T00:52:33Z","updated_at":"2016-07-01T00:52:38Z","pushed_at":"2016-09-22T09:17:10Z","git_url":"git://github.com/foryou2030/incubator-carbondata.git","ssh_url":"git@github.com:foryou2030/incubator-carbondata.git","clone_url":"https://github.com/foryou2030/incubator-carbondata.git","svn_url":"https://github.com/foryou2030/incubator-carbondata","homepage":null,"size":37820,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"apache:master","ref":"master","sha":"676bd96bdcb5f850d64f419175f5b1fd0ee2a8ad","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","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":62117818,"name":"incubator-carbondata","full_name":"apache/incubator-carbondata","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","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},"private":false,"html_url":"https://github.com/apache/incubator-carbondata","description":"Mirror of Apache CarbonData (Incubating)","fork":false,"url":"https://api.github.com/repos/apache/incubator-carbondata","forks_url":"https://api.github.com/repos/apache/incubator-carbondata/forks","keys_url":"https://api.github.com/repos/apache/incubator-carbondata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/incubator-carbondata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/incubator-carbondata/teams","hooks_url":"https://api.github.com/repos/apache/incubator-carbondata/hooks","issue_events_url":"https://api.github.com/repos/apache/incubator-carbondata/issues/events{/number}","events_url":"https://api.github.com/repos/apache/incubator-carbondata/events","assignees_url":"https://api.github.com/repos/apache/incubator-carbondata/assignees{/user}","branches_url":"https://api.github.com/repos/apache/incubator-carbondata/branches{/branch}","tags_url":"https://api.github.com/repos/apache/incubator-carbondata/tags","blobs_url":"https://api.github.com/repos/apache/incubator-carbondata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/incubator-carbondata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/incubator-carbondata/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/incubator-carbondata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/incubator-carbondata/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/incubator-carbondata/languages","stargazers_url":"https://api.github.com/repos/apache/incubator-carbondata/stargazers","contributors_url":"https://api.github.com/repos/apache/incubator-carbondata/contributors","subscribers_url":"https://api.github.com/repos/apache/incubator-carbondata/subscribers","subscription_url":"https://api.github.com/repos/apache/incubator-carbondata/subscription","commits_url":"https://api.github.com/repos/apache/incubator-carbondata/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/incubator-carbondata/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/incubator-carbondata/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/incubator-carbondata/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/incubator-carbondata/contents/{+path}","compare_url":"https://api.github.com/repos/apache/incubator-carbondata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/incubator-carbondata/merges","archive_url":"https://api.github.com/repos/apache/incubator-carbondata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/incubator-carbondata/downloads","issues_url":"https://api.github.com/repos/apache/incubator-carbondata/issues{/number}","pulls_url":"https://api.github.com/repos/apache/incubator-carbondata/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/incubator-carbondata/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/incubator-carbondata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/incubator-carbondata/labels{/name}","releases_url":"https://api.github.com/repos/apache/incubator-carbondata/releases{/id}","deployments_url":"https://api.github.com/repos/apache/incubator-carbondata/deployments","created_at":"2016-06-28T07:00:06Z","updated_at":"2016-09-23T01:30:51Z","pushed_at":"2016-09-22T22:31:54Z","git_url":"git://github.com/apache/incubator-carbondata.git","ssh_url":"git@github.com:apache/incubator-carbondata.git","clone_url":"https://github.com/apache/incubator-carbondata.git","svn_url":"https://github.com/apache/incubator-carbondata","homepage":null,"size":39370,"stargazers_count":118,"watchers_count":118,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":107,"mirror_url":"git://git.apache.org/incubator-carbondata.git","open_issues_count":22,"forks":107,"open_issues":22,"watchers":118,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-carbondata/pulls/176"},"html":{"href":"https://github.com/apache/incubator-carbondata/pull/176"},"issue":{"href":"https://api.github.com/repos/apache/incubator-carbondata/issues/176"},"comments":{"href":"https://api.github.com/repos/apache/incubator-carbondata/issues/176/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/incubator-carbondata/pulls/176/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/incubator-carbondata/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/incubator-carbondata/pulls/176/commits"},"statuses":{"href":"https://api.github.com/repos/apache/incubator-carbondata/statuses/38ba878d9eae3c256c9de113e8602785a7fc8104"}}}}
{"actor":{"display_login":"jackylk"}}