String table1="cassjoin"+ new Random().nextInt(200);
String tblpay = "{\"name\":\""+table1+"\",\"columns\":\"username,friends,wall,status\",\"primarykey\":\"username\",\"storage\":\"unit.remotecassandra\"}";
String db = "jointest";
JsonObject pload = new JsonObject(tblpay);
pload.putString("db", db);
try {
metasvc.writeMetaEntity(EntityType.TABLE, pload.toString());
} catch (StorageDoesNotExistException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Print("table:"+(System.currentTimeMillis() - start));
String insertPay = "{\"columns\":\"username,friends,wall,status\",\"values\":\"'federer','rafa#haas#tommy#sachin#beckham','getting ready for my next#out of wimbledon#out of french','looking fwd to my next match'\"}";
datasvc.writeRow(db, table1, new JsonObject(insertPay));
Print("insert cass:"+(System.currentTimeMillis() - start));
String table2="mysqljoin" + new Random().nextInt(200);;
tblpay = "{\"name\":\""+table2+"\",\"columns\":\"username,first,last,lastlogin,paid,address,email\",\"primarykey\":\"username\",\"storage\":\"unit.mysqlremote\"}";
pload = new JsonObject(tblpay);
pload.putString("db", db);
try {
metasvc.writeMetaEntity(EntityType.TABLE, pload.toString());
} catch (StorageDoesNotExistException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Print("create mysql table:"+(System.currentTimeMillis() - start));
insertPay = "{\"columns\":\"username,first,last,lastlogin,paid,address,email\",\"values\":\"'federer','Roger','Federer','july first','paid','1 swiss drive','RF@gmail.com'\"}";
datasvc.writeRow(db, table2, new JsonObject(insertPay));
Print("insert mysql row:"+(System.currentTimeMillis() - start));
String str = datasvc.doJoin(db, table1, table2, "username", "rogerfederer");
Print("Join:"+(System.currentTimeMillis() - start));