q1.append("'0000000001'TO '0000000009'");
}
q1.append("SERVER FILTER where val1+'ss' BETWEEN '11ss' AND '13ss' ");
HStatement stmt = connection.createStatement();
QueryFuture future = stmt.executeQueryAsync(q1.toString(), new QueryListener<HRecord>() {
AtomicInteger rec_cnt = new AtomicInteger(0);
public void onQueryStart() {
//System.out.println("Starting query");
}
public void onEachRow(final HRecord rec) throws HBqlException {
String keyval = (String)rec.getCurrentValue("keyval");
String val1 = (String)rec.getCurrentValue("val1");
int val2 = (Integer)rec.getCurrentValue("f1:val2");
int val3 = (Integer)rec.getCurrentValue("val3");
//System.out.println("Current Values: " + keyval + " : " + val1 + " : " + val2 + " : " + val3);
this.rec_cnt.incrementAndGet();
}
public void onQueryComplete() {
System.out.println("Finished query with rec_cnt = " + rec_cnt.get() + " vs " + (keyCount * 3));
assertTrue(rec_cnt.get() == keyCount * 3);
}
public void onException(final ExceptionSource source, final HBqlException e) {
e.printStackTrace();
}
});
futureList.add(future);
}
for (final QueryFuture future : futureList) {
try {
future.await();
}
catch (InterruptedException e) {
e.printStackTrace();
}
}