use of org.apache.accumulo.core.iterators.user.SummingCombiner in project accumulo by apache.
the class SimpleProxyBase method iteratorFunctionality.
@Test
public void iteratorFunctionality() throws Exception {
// iterators
HashMap<String, String> options = new HashMap<>();
options.put("type", "STRING");
options.put("columns", "cf");
IteratorSetting setting = new IteratorSetting(10, tableName, SummingCombiner.class.getName(), options);
client.attachIterator(creds, tableName, setting, EnumSet.allOf(IteratorScope.class));
for (int i = 0; i < 10; i++) {
client.updateAndFlush(creds, tableName, mutation("row1", "cf", "cq", "1"));
}
// 10 updates of "1" in the value w/ SummingCombiner should return value of "10"
assertScan(new String[][] { { "row1", "cf", "cq", "10" } }, tableName);
try {
client.checkIteratorConflicts(creds, tableName, setting, EnumSet.allOf(IteratorScope.class));
fail("checkIteratorConflicts did not throw an exception");
} catch (Exception ex) {
// Expected
}
client.deleteRows(creds, tableName, null, null);
client.removeIterator(creds, tableName, "test", EnumSet.allOf(IteratorScope.class));
String[][] expected = new String[10][];
for (int i = 0; i < 10; i++) {
client.updateAndFlush(creds, tableName, mutation("row" + i, "cf", "cq", "" + i));
expected[i] = new String[] { "row" + i, "cf", "cq", "" + i };
client.flushTable(creds, tableName, null, null, true);
}
assertScan(expected, tableName);
}
Aggregations