Skip to content

Instantly share code, notes, and snippets.

@msval
Created November 7, 2015 15:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msval/bc2a397278bcef5c38ce to your computer and use it in GitHub Desktop.
Save msval/bc2a397278bcef5c38ce to your computer and use it in GitHub Desktop.
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