+ "predictions map<ascii,ascii>, archive blob, LOG varchar, PRIMARY KEY(JobID));");
session.execute("CREATE TABLE IF NOT EXISTS JobDateInfo "
- + "(jobday bigint, Total bigint, PRIMARY KEY(jobday));");
+ + "(jobday bigint, Total bigint, Program varchar, Version varchar, PRIMARY KEY(jobday));");
session.execute("CREATE INDEX IF NOT EXISTS ProteinSeq ON ProteinRow (protein);");
session.execute("CREATE INDEX IF NOT EXISTS JobDateStamp ON ProteinData (jobtime);");
* fill new table
*/
public void FillNewTable() {
- long date1 = CassandraNativeConnector.getEarliestDateInDB();
- Calendar start = Calendar.getInstance();
- start.setTime(new Date(date1));
+ final long StartTime = System.currentTimeMillis();
+ long erldate = CassandraNativeConnector.getEarliestDateInDB();
+ Calendar runnicCal = Calendar.getInstance();
+ runnicCal.setTime(new Date(erldate));
Calendar endcal = Calendar.getInstance();
- Date end = endcal.getTime();
- for (Date date = start.getTime(); !start.after(end); start.add(Calendar.DATE, 1), date = start.getTime()) {
- final long startTime = System.currentTimeMillis();
- String query1 = "SELECT * FROM ProteinData WHERE jobtime = " + date.getTime() + ";";
- System.out.println("Query db: " + query1);
+ long endTime = endcal.getTime().getTime();
+ for (Date date = runnicCal.getTime(); date.getTime() < endTime; runnicCal.add(Calendar.DATE, 1), date = runnicCal.getTime()) {
try {
- ResultSet results = session.execute(query1);
- final long queryTime = System.currentTimeMillis();
- System.out.println("Query time for " + date.toString() + " is " + (queryTime - startTime) + " msec");
- String query2 = "INSERT INTO JobDateInfo " + "(jobday, Total)" + " VALUES (" + date.getTime() + "," + results.all().size()
- + ");";
- System.out.println("Insert DB: " + query2);
- session.execute(query2);
+ ResultSet results = session.execute("SELECT * FROM ProteinData WHERE jobtime = " + date.getTime() + ";");
+ session.execute("INSERT INTO JobDateInfo " + "(jobday, Total)" + " VALUES (" + date.getTime() + "," + results.all().size()
+ + ");");
} catch (QueryExecutionException e) {
e.printStackTrace();
}
}
- System.out.println("Table JobDateInfo filled");
+ System.out.println("Table JobDateInfo filled: total time is " + (System.currentTimeMillis() - StartTime) + " msec");
}
/*
* fill a table with the database global parameters
*/
- public void FillParameters() {
+ public void FillMainDBParameters() {
Date bubu = new Date(CassandraNativeConnector.getEarliestDateInDB());
System.out.println("Old EarliestJobDate is " + bubu.toString());