Package org.apache.hadoop.chukwa.database

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


      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


  }

  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(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

    } 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

   
    // Verify Data
    DatabaseWriter db = null;
    try {
      db = new DatabaseWriter(cluster);
      Macro mp = new Macro(current,current, "select * from [system_metrics]");
      String query = mp.toString();
      ResultSet rs = db.query(query);
      ResultSetMetaData rmeta = rs.getMetaData();
      int size = rmeta.getColumnCount();
      while(rs.next()) {
        for(int i=1;i<=size;i++) {
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;
    DefaultSQLDataHandler dh = new DefaultSQLDataHandler();
View Full Code Here

  if (field.compareTo("timestamp")==0) {
      startTime = Long.parseLong(timestamp);
      endTime = Long.parseLong(timestamp);
  }

  Macro mp = new Macro(startTime, endTime, table, null);
  String query = mp.toString();
  StringBuilder queryBuilder = new StringBuilder();
  queryBuilder.append("select * from ");
  queryBuilder.append(query);
  if (field.compareTo("timestamp")==0) {
      queryBuilder.append(" where "+field+" = \""+convertLongToDateString(Long.parseLong(timestamp))+"\"");
View Full Code Here

  StringBuilder queryBuilder = new StringBuilder();
  queryBuilder.append("select * from ");
  queryBuilder.append(table);
  queryBuilder.append(" where timestamp between \"[start]\" and \"[end]\"");
  String query = queryBuilder.toString();
  Macro mp = new Macro(startTime, endTime, query, null);
  query = mp.toString();
  log.error("query:"+query);
  return query;
    }
View Full Code Here

  // default time
  long startTime = now.getTimeInMillis()-(7*24*60*60*1000);
  long endTime = now.getTimeInMillis();

  Macro mp = new Macro(startTime, endTime, table, null);
  String query = mp.toString();
  StringBuilder queryBuilder = new StringBuilder();
  queryBuilder.append("select * from ");
  queryBuilder.append(query);
  queryBuilder.append(" where ");
  int count=0;
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.