Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
if ("skinny-3of12".equalsIgnoreCase(operation)) {
Select query = QueryBuilder.
select("activity_id", "start_time", "end_time").
from("activities").
where(eq("activity_id", bindMarker())).limit(1);
PreparedStatement select = session.prepare(query);
BoundStatement bstmt = new BoundStatement(select);
bstmt.bind(UUID.fromString("72b493f0-e59d-11e3-9bd6-0050568317e1"));
Activity3of12 a;
ResultSet results;
Row row;
startTime = System.currentTimeMillis();
for (int i = 0; i < count; i++) {
results = session.execute(bstmt);
row = results.one();
a = new Activity3of12(row.getUUID("activity_id"), row.getDate("start_time"), row.getDate("end_time"));
log.info("{}, {}, {}", a.getActivityId(), a.getStartTime(), a.getEndTime());
}
}
else if ("skinny".equalsIgnoreCase(operation)) {
Select query = QueryBuilder.
select().
from("activities").
where(eq("activity_id", bindMarker())).limit(1);
PreparedStatement select = session.prepare(query);
BoundStatement bstmt = new BoundStatement(select);
bstmt.bind(UUID.fromString("72b493f0-e59d-11e3-9bd6-0050568317e1"));
Activity a;
ResultSet results;
Row row;
startTime = System.currentTimeMillis();
for (int i = 0; i < count; i++) {
results = session.execute(bstmt);
row = results.one();
a = new Activity(row.getUUID("activity_id"), row.getLong("activity_model_id"), row.getString("activity_state"),
row.getString("asset_id"), row.getMap("attrs", String.class, String.class), row.getDate("creation_time"),
row.getString("customer_id"), row.getDate("end_time"), row.getDate("last_modified_time"), row.getString("person_id"),
row.getString("poi_id"), row.getDate("start_time"));
log.info("{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}",
a.getActivity_id(), a.getActivity_model_id(), a.getActivity_state(), a.getAsset_id(),
a.getAttrs().size(), a.getCreation_time(), a.getCustomer_id(), a.getEnd_time(),
a.getLast_modified_time(), a.getPerson_id(), a.getPoi_id(), a.getStart_time());
}
}
long endTime = System.currentTimeMillis();
log.info("Duration: {} ms", endTime - startTime);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment