carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenliang...@apache.org
Subject [1/2] incubator-carbondata git commit: fix query stats format problem
Date Thu, 30 Mar 2017 06:58:26 GMT
Repository: incubator-carbondata
Updated Branches:
  refs/heads/master 5d2ae6be2 -> 6c639411d


fix query stats format problem


Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/c52fd93d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/c52fd93d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/c52fd93d

Branch: refs/heads/master
Commit: c52fd93d23e8786beb49452b146532231fecb935
Parents: 5d2ae6b
Author: jackylk <jacky.likun@huawei.com>
Authored: Mon Mar 27 20:43:09 2017 +0530
Committer: jackylk <jacky.likun@huawei.com>
Committed: Thu Mar 30 11:25:02 2017 +0530

----------------------------------------------------------------------
 .../core/stats/QueryStatisticsRecorderImpl.java | 77 ++++++++++----------
 1 file changed, 38 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/c52fd93d/core/src/main/java/org/apache/carbondata/core/stats/QueryStatisticsRecorderImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/stats/QueryStatisticsRecorderImpl.java
b/core/src/main/java/org/apache/carbondata/core/stats/QueryStatisticsRecorderImpl.java
index 3f048c6..16abaa4 100644
--- a/core/src/main/java/org/apache/carbondata/core/stats/QueryStatisticsRecorderImpl.java
+++ b/core/src/main/java/org/apache/carbondata/core/stats/QueryStatisticsRecorderImpl.java
@@ -87,53 +87,52 @@ public class QueryStatisticsRecorderImpl implements QueryStatisticsRecorder,
Ser
    * Below method will parse queryStatisticsMap and put time into table
    */
   public String collectExecutorStatistics() {
-    String load_blocks_time = "";
-    String scan_blocks_time = "";
-    String scan_blocks_num = "";
-    String load_dictionary_time = "";
-    String result_size = "";
-    String total_executor_time = "";
-    String splitChar = " ";
-    String total_blocklet = "";
-    String valid_scan_blocklet = "";
-    String valid_pages_blocklet = "";
-    String total_pages = "";
-    String readTime = "";
+    long load_blocks_time = 0;
+    long scan_blocks_time = 0;
+    long scan_blocks_num = 0;
+    long load_dictionary_time = 0;
+    long result_size = 0;
+    long total_executor_time = 0;
+    long total_blocklet = 0;
+    long valid_scan_blocklet = 0;
+    long valid_pages_blocklet = 0;
+    long total_pages = 0;
+    long readTime = 0;
     try {
       for (QueryStatistic statistic : queryStatistics) {
         switch (statistic.getMessage()) {
           case QueryStatisticsConstants.LOAD_BLOCKS_EXECUTOR:
-            load_blocks_time += statistic.getTimeTaken() + splitChar;
+            load_blocks_time += statistic.getTimeTaken();
             break;
           case QueryStatisticsConstants.SCAN_BLOCKlET_TIME:
-            scan_blocks_time += statistic.getCount() + splitChar;
+            scan_blocks_time += statistic.getCount();
             break;
           case QueryStatisticsConstants.SCAN_BLOCKS_NUM:
-            scan_blocks_num += statistic.getCount() + splitChar;
+            scan_blocks_num += statistic.getCount();
             break;
           case QueryStatisticsConstants.LOAD_DICTIONARY:
-            load_dictionary_time += statistic.getTimeTaken() + splitChar;
+            load_dictionary_time += statistic.getTimeTaken();
             break;
           case QueryStatisticsConstants.RESULT_SIZE:
-            result_size += statistic.getCount() + splitChar;
+            result_size += statistic.getCount();
             break;
           case QueryStatisticsConstants.EXECUTOR_PART:
-            total_executor_time += statistic.getTimeTaken() + splitChar;
+            total_executor_time += statistic.getTimeTaken();
             break;
           case QueryStatisticsConstants.TOTAL_BLOCKLET_NUM:
-            total_blocklet = statistic.getCount() + splitChar;
+            total_blocklet = statistic.getCount();
             break;
           case QueryStatisticsConstants.VALID_SCAN_BLOCKLET_NUM:
-            valid_scan_blocklet = statistic.getCount() + splitChar;
+            valid_scan_blocklet = statistic.getCount();
             break;
           case QueryStatisticsConstants.VALID_PAGE_SCANNED:
-            valid_pages_blocklet = statistic.getCount() + splitChar;
+            valid_pages_blocklet = statistic.getCount();
             break;
           case QueryStatisticsConstants.TOTAL_PAGE_SCANNED:
-            total_pages = statistic.getCount() + splitChar;
+            total_pages = statistic.getCount();
             break;
           case QueryStatisticsConstants.READ_BLOCKlET_TIME:
-            readTime = statistic.getCount() + splitChar;
+            readTime = statistic.getCount();
             break;
           default:
             break;
@@ -145,17 +144,17 @@ public class QueryStatisticsRecorderImpl implements QueryStatisticsRecorder,
Ser
               + "valid_blocklets,total_pages,valid_pages,result_size";
       List<String> values = new ArrayList<String>();
       values.add(queryIWthTask);
-      values.add(load_blocks_time);
-      values.add(load_dictionary_time);
-      values.add(scan_blocks_time);
-      values.add(readTime);
-      values.add(total_executor_time);
-      values.add(scan_blocks_num);
-      values.add(total_blocklet);
-      values.add(valid_scan_blocklet);
-      values.add(total_pages);
-      values.add(valid_pages_blocklet);
-      values.add(result_size);
+      values.add(load_blocks_time + "ms");
+      values.add(load_dictionary_time + "ms");
+      values.add(scan_blocks_time + "ms");
+      values.add(readTime + "ms");
+      values.add(total_executor_time + "ms");
+      values.add(String.valueOf(scan_blocks_num));
+      values.add(String.valueOf(total_blocklet));
+      values.add(String.valueOf(valid_scan_blocklet));
+      values.add(String.valueOf(total_pages));
+      values.add(String.valueOf(valid_pages_blocklet));
+      values.add(String.valueOf(result_size));
       StringBuilder tableInfo = new StringBuilder();
       String[] columns = headers.split(",");
       String line = "";
@@ -168,11 +167,11 @@ public class QueryStatisticsRecorderImpl implements QueryStatisticsRecorder,
Ser
         valueLine += "|" + printLine(" ", len - values.get(i).length()) + values.get(i);
       }
       // struct table info
-      tableInfo.append(line + "+").append("\n");
-      tableInfo.append(hearLine + "|").append("\n");
-      tableInfo.append(line + "+").append("\n");
-      tableInfo.append(valueLine + "|").append("\n");
-      tableInfo.append(line + "+").append("\n");
+      tableInfo.append(line).append("+").append("\n");
+      tableInfo.append(hearLine).append("|").append("\n");
+      tableInfo.append(line).append("+").append("\n");
+      tableInfo.append(valueLine).append("|").append("\n");
+      tableInfo.append(line).append("+").append("\n");
       return "Print query statistic for each task id:" + "\n" + tableInfo.toString();
     } catch (Exception ex) {
       return "Put statistics into table failed, catch exception: " + ex.getMessage();


Mime
View raw message