Package org.apache.hadoop.chukwa.database

Examples of org.apache.hadoop.chukwa.database.Macro


    } else if (this.query_state != null && this.query_state.equals("write")) {
      query = "select block_id,start_time,finish_time,start_time_millis,finish_time_millis,status,state_name,hostname,other_host,bytes from ["+table+"] where finish_time between '[start]' and '[end]' and (state_name like 'write_local' or state_name like 'write_remote' or state_name like 'write_replicated')";
    } else {
      query = "select block_id,start_time,finish_time,start_time_millis,finish_time_millis,status,state_name,hostname,other_host,bytes from ["+table+"] where finish_time between '[start]' and '[end]' and state_name like '" + query_state + "'";
    }
    Macro mp = new Macro(start,end,query);
    query = mp.toString() + " order by start_time";
   
    ArrayList<HashMap<String, Object>> events = new ArrayList<HashMap<String, Object>>();

    ResultSet rs = null;
   
View Full Code Here


    }
    if(!skip) {
      DatabaseWriter db = new DatabaseWriter(cluster);
      for(int i=0;i<tables.length;i++) {
        String query = "select [avg("+tables[i]+")] from ["+tables[i]+"]";
        Macro mp = new Macro(current,query);
        query = mp.toString();
        try {
          ResultSet rs = db.query(query);
          ResultSetMetaData rsmd = rs.getMetaData();
          int numberOfColumns = rsmd.getColumnCount();
          while(rs.next()) {
View Full Code Here

  }

  public void verifyTable(String table) {
    ChukwaConfiguration cc = new ChukwaConfiguration();
    String query = "select * from ["+table+"];";
    Macro mp = new Macro(current,query);
    query = mp.toString();
    try {
      DatabaseWriter db = new DatabaseWriter(cluster);
      ResultSet rs = db.query(query);
      while(rs.next()) {
        int i = 1;
View Full Code Here

      assertTrue("DataExpiration executed.", true);
      DatabaseWriter db = null;
      try {
        db = new DatabaseWriter(cluster);
        String query = "select * from [system_metrics];";
        Macro mp = new Macro(current,query);
        query = mp.toString();
        ResultSet rs = db.query(query);
      } catch(SQLException ex) {
        assertTrue("Table is not suppose to exist.",true);
        db.close();
      }
View Full Code Here

      query = "select job_id,friendly_id,start_time,finish_time,start_time_millis,finish_time_millis,status,state_name,hostname from ["+this.table+"] where finish_time between '[start]' and '[end]' and not state_name like 'shuffle_local' and not state_name like 'shuffle_remote'";
    }
    if (this.jobname != null) {
      query = query + " and job_id like '"+ this.jobname +"'";
    }
    Macro mp = new Macro(start,end,query);
    query = mp.toString() + " order by start_time";
   
    Table rs_tab = null;   
    DatabaseDataSource dds;

    log.debug("Query: " + query);
View Full Code Here

    Date today = new Date();
    long current = today.getTime();
    Timestamp timestamp = new Timestamp(current);
    String hostname="chukwa.example.org";
    String query = "insert into [system_metrics] set timestamp='"+timestamp.toString()+"', host='"+hostname+"', cpu_user_pcnt=100;";
    Macro mp = new Macro(current, current, query);
    query = mp.toString();
    try {
      db.execute(query);
      query = "select timestamp,host,cpu_user_pcnt from [system_metrics] where timestamp=? and host=? and cpu_user_pcnt=?;";
      mp = new Macro(current, current, query);
      query = mp.toString();
      ArrayList<Object> parms = new ArrayList<Object>();
      parms.add(current);
      parms.add(hostname);
      parms.add(100);
      ResultSet rs = db.query(query, parms);
View Full Code Here

  }

  public void verifyTable(String table) {
    ChukwaConfiguration cc = new ChukwaConfiguration();
    String query = "select * from ["+table+"];";
    Macro mp = new Macro(current,query);
    query = mp.toString();
    try {
      DatabaseWriter db = new DatabaseWriter(cluster);
      ResultSet rs = db.query(query);
      while(rs.next()) {
        int i = 1;
View Full Code Here

    for(int i=0;i<timeWindow.length;i++) {
      try {
        DatabaseWriter db = new DatabaseWriter(cluster);
        for(String table : tables) {
          String query = "select * from ["+table+"];";
          Macro mp = new Macro(current,query);
          query = mp.toString();
          ResultSet rs = db.query(query);
          rs.last();
          int count = rs.getRow();
          assertTrue("Table should exist and return empty result.", count==0);
        }
View Full Code Here

    }

  public void verifyTable(String table) {
    ChukwaConfiguration cc = new ChukwaConfiguration();
    String query = "select * from ["+table+"];";
    Macro mp = new Macro(dbSetup.current,query);
    query = mp.toString();
    try {
      DatabaseWriter db = new DatabaseWriter(dbSetup.cluster);
      ResultSet rs = db.query(query);
      while(rs.next()) {
        int i = 1;
View Full Code Here

  }

  public void verifyTable(String table) {
    ChukwaConfiguration cc = new ChukwaConfiguration();
    String query = "select * from ["+table+"];";
    Macro mp = new Macro(current,query);
    query = mp.toString();
    try {
      DatabaseWriter db = new DatabaseWriter(cluster);
      ResultSet rs = db.query(query);
      while(rs.next()) {
        int i = 1;
View Full Code Here

TOP

Related Classes of org.apache.hadoop.chukwa.database.Macro

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.