use of org.apache.accumulo.proxy.thrift.Key in project accumulo by apache.
the class TestProxyReadWrite method readWriteBatchOneShotWithRange.
/**
* Insert 100000 cells which have as the row [0..99999] (padded with zeros). Set a range so only the entries between -Inf...5 come back (there should be
* 50,000)
*/
@Test
public void readWriteBatchOneShotWithRange() throws Exception {
int maxInserts = 100000;
Map<ByteBuffer, List<ColumnUpdate>> mutations = new HashMap<>();
String format = "%1$05d";
for (int i = 0; i < maxInserts; i++) {
addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
if (i % 1000 == 0 || i == maxInserts - 1) {
tpc.proxy().updateAndFlush(userpass, testtable, mutations);
mutations.clear();
}
}
Key stop = new Key();
stop.setRow("5".getBytes());
BatchScanOptions options = new BatchScanOptions();
options.ranges = Collections.singletonList(new Range(null, false, stop, false));
String cookie = tpc.proxy().createBatchScanner(userpass, testtable, options);
int i = 0;
boolean hasNext = true;
int k = 1000;
while (hasNext) {
ScanResult kvList = tpc.proxy().nextK(cookie, k);
i += kvList.getResultsSize();
hasNext = kvList.isMore();
}
assertEquals(i, 50000);
}
Aggregations