chukwa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ey...@apache.org
Subject svn commit: r779330 - in /hadoop/chukwa/trunk: database_upgrade_0.1.1-0.1.2.sql src/java/org/apache/hadoop/chukwa/hicc/Chart.java src/java/org/apache/hadoop/chukwa/hicc/DatasetMapper.java
Date Wed, 27 May 2009 21:47:50 GMT
Author: eyang
Date: Wed May 27 21:47:50 2009
New Revision: 779330

URL: http://svn.apache.org/viewvc?rev=779330&view=rev
Log:
CHUKWA-261. Added X axis label for non Time Series graphs. (Eric Yang)

Added:
    hadoop/chukwa/trunk/database_upgrade_0.1.1-0.1.2.sql
Modified:
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/hicc/Chart.java
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/hicc/DatasetMapper.java

Added: hadoop/chukwa/trunk/database_upgrade_0.1.1-0.1.2.sql
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/database_upgrade_0.1.1-0.1.2.sql?rev=779330&view=auto
==============================================================================
--- hadoop/chukwa/trunk/database_upgrade_0.1.1-0.1.2.sql (added)
+++ hadoop/chukwa/trunk/database_upgrade_0.1.1-0.1.2.sql Wed May 27 21:47:50 2009
@@ -0,0 +1,60 @@
+DELIMITER $$
+DROP PROCEDURE IF EXISTS UpgradeTable$$
+CREATE PROCEDURE UpgradeTable()
+BEGIN
+    DECLARE str VARCHAR(4000);
+    DECLARE tname VARCHAR(255);
+    DECLARE counter INT DEFAULT 0;
+    DECLARE st CURSOR FOR SELECT t.TABLE_NAME FROM INFORMATION_SCHEMA.TABLES t WHERE t.TABLE_NAME
LIKE 'mr_job_%' and t.TABLE_NAME!='mr_job_template';
+    DECLARE cnt CURSOR FOR SELECT count(t.TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES t WHERE
t.TABLE_NAME LIKE 'mr_job_%' and t.TABLE_NAME!='mr_job_template';
+    DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET counter = counter - 1;
+    OPEN cnt;
+    FETCH cnt INTO counter;
+    CLOSE cnt;
+    OPEN st;
+    REPEAT
+        FETCH st INTO tname;
+        SET @str = CONCAT('ALTER IGNORE TABLE ',tname,' ADD COLUMN finished_maps bigint default
0, ADD COLUMN finished_reduces bigint default 0, ADD COLUMN failed_maps bigint default 0,
ADD COLUMN failed_reduces bigint default 0, ADD COLUMN total_maps bigint default 0, ADD COLUMN
total_reduces bigint default 0, ADD COLUMN reduce_shuffle_bytes bigint default 0;');
+        SELECT tname;
+        PREPARE stmt from @str;
+        EXECUTE stmt;
+        COMMIT;
+        DEALLOCATE PREPARE stmt;	
+        SET counter = counter - 1;
+	UNTIL counter=0 END REPEAT;
+    CLOSE st;
+END$$
+DELIMITER ;
+
+call UpgradeTable();
+
+DELIMITER $$
+DROP PROCEDURE IF EXISTS UpgradeTable$$
+CREATE PROCEDURE UpgradeTable()
+BEGIN
+    DECLARE str VARCHAR(4000);
+    DECLARE tname VARCHAR(255);
+    DECLARE counter INT DEFAULT 0;
+    DECLARE st CURSOR FOR SELECT t.TABLE_NAME FROM INFORMATION_SCHEMA.TABLES t WHERE t.TABLE_NAME
LIKE 'mr_task_%' and t.TABLE_NAME!='mr_task_template';
+    DECLARE cnt CURSOR FOR SELECT count(t.TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES t WHERE
t.TABLE_NAME LIKE 'mr_task_%' and t.TABLE_NAME!='mr_task_template';
+    DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET counter = counter - 1;
+    OPEN cnt;
+    FETCH cnt INTO counter;
+    CLOSE cnt;
+    OPEN st;
+	REPEAT
+        FETCH st INTO tname;
+        SET @str = CONCAT('ALTER IGNORE TABLE ',tname,' ADD COLUMN type VARCHAR(20),ADD COLUMN
reduce_shuffle_bytes bigint default 0,ADD COLUMN hostname VARCHAR(80),ADD COLUMN shuffle_finished
timestamp default 0,ADD COLUMN sort_finished timestamp default 0,ADD COLUMN spilts bigint
default 0;');
+        SELECT tname;
+        PREPARE stmt from @str;
+        EXECUTE stmt;
+        COMMIT;
+        DEALLOCATE PREPARE stmt;
+        SET counter = counter - 1;
+        UNTIL counter=0 END REPEAT;
+    CLOSE st;
+END$$
+DELIMITER ;
+
+call UpgradeTable();
+DROP PROCEDURE IF EXISTS UpgradeTable;

Modified: hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/hicc/Chart.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/hicc/Chart.java?rev=779330&r1=779329&r2=779330&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/hicc/Chart.java (original)
+++ hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/hicc/Chart.java Wed May 27 21:47:50
2009
@@ -210,7 +210,7 @@
       xAxisOptions.append("\",mode: \"time\"");
     } else {
       xAxisOptions
-          .append("tickFormatter: function (val, axis) { return xLabels[Math.round(val)];
}, ticks: 0");
+          .append("tickFormatter: function (val, axis) { if(val!=0) { return xLabels[Math.round(val)];
} else { return \" \"; }; }, ticks: 5");
     }
     if (request != null && xf.getParameter("format") == null) {
       output

Modified: hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/hicc/DatasetMapper.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/hicc/DatasetMapper.java?rev=779330&r1=779329&r2=779330&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/hicc/DatasetMapper.java (original)
+++ hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/hicc/DatasetMapper.java Wed May
27 21:47:50 2009
@@ -62,9 +62,11 @@
     try {
       conn = org.apache.hadoop.chukwa.util.DriverManagerUtil.getConnection(jdbc);
       stmt = conn.prepareStatement(query);
-      for(int i=0;i<parameters.size();i++) {
-        int index = i+1;
-        stmt.setObject(index,parameters.get(i));
+      if(query.indexOf("?")!=-1) {
+        for(int i=0;i<parameters.size();i++) {
+          int index = i+1;
+          stmt.setObject(index,parameters.get(i));
+        }
       }
       // rs = stmt.executeQuery(query);
       if (stmt.execute()) {



Mime
View raw message