Skip to content

Instantly share code, notes, and snippets.

@zznate
Created February 28, 2012 17:00
Show Gist options
  • Save zznate/1933662 to your computer and use it in GitHub Desktop.
Save zznate/1933662 to your computer and use it in GitHub Desktop.
public Integer call() {
Mutator<String> mutator = HFactory.createMutator(tutorialKeyspace, StringSerializer.get());
int count = 0;
for (int x=0; x<5000; x++) {
mutator.addInsertion(myKey,CF_TIMESERIES_SINGLE_ROW, buildColumnFor(x));
}
mutator.execute();
log.debug("Inserted {} rows", count);
return Integer.valueOf(count);
}
private HColumn<Long,Long> buildColumnFor(int colName) {
// Using the clock available through hector to generate microsecond precision longs
HColumn<Long,Long> column = HFactory.createColumn(tutorialKeyspace.createClock(), RandomUtils.nextLong(),
LongSerializer.get(), LongSerializer.get());
return column;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment