new type date request
authorNatasha Sherstneva <n.shertneva@gmail.com>
Fri, 8 Nov 2013 15:03:49 +0000 (15:03 +0000)
committerNatasha Sherstneva <n.shertneva@gmail.com>
Fri, 8 Nov 2013 15:03:49 +0000 (15:03 +0000)
datadb/compbio/cassandra/CassandraNativeConnector.java
server/compbio/statistic/CassandraRequester.java

index 6e6992d..8e76d43 100644 (file)
@@ -228,17 +228,16 @@ public class CassandraNativeConnector {
         */
        public Integer ReadDateTable(long queryDate) {
                final long startTime = System.currentTimeMillis();
-               String com = "SELECT jobtime, JobID FROM ProteinData WHERE jobtime = " + queryDate + ";";
+               String com = "SELECT count(*) FROM ProteinData WHERE jobtime = " + queryDate + ";";
                System.out.println("Command: " + com);
                ResultSet results = session.execute(com);
                final long queryTime = System.currentTimeMillis();
                System.out.println("Query time is " + (queryTime - startTime) + " msec");
-               if (results.isExhausted())
-                       return 0;
-               List<Row> rows = results.all();
+               Row row = results.one();
+               Integer count = (int) row.getLong(0);
                final long endTime = System.currentTimeMillis();
-               System.out.println("Processing time is " + (endTime - queryTime) + " msec");
-               return rows.size();
+               System.out.println("Processing time is " + (endTime - queryTime) + " msec");            
+               return count;
        }
 
        /*
index 5682cdb..92ca531 100755 (executable)
@@ -141,6 +141,7 @@ public class CassandraRequester {
                query = new ArrayList<DataBase>();
                for (Date date = start.getTime(); !start.after(end); start.add(Calendar.DATE, 1), date = start.getTime()) {
                        Integer res = DBInstance.ReadDateTable(date.getTime());
+                       System.out.println("Command: " + res);
                        if (res == null)
                                continue;
                        DataBase db = new DataBase();