Search in sources :

Example 1 with CountingIterator

use of org.apache.accumulo.core.iterators.system.CountingIterator in project accumulo by apache.

the class FirstEntryInRowIteratorTest method process.

private static long process(TreeMap<Key, Value> sourceMap, TreeMap<Key, Value> resultMap, Range range, IteratorSetting iteratorSetting) throws IOException {
    org.apache.accumulo.core.iterators.SortedMapIterator source = new SortedMapIterator(sourceMap);
    CountingIterator counter = new CountingIterator(source);
    FirstEntryInRowIterator feiri = new FirstEntryInRowIterator();
    IteratorEnvironment env = new BaseIteratorEnvironment();
    feiri.init(counter, iteratorSetting.getOptions(), env);
    feiri.seek(range, LocalityGroupUtil.EMPTY_CF_SET, false);
    while (feiri.hasTop()) {
        resultMap.put(feiri.getTopKey(), feiri.getTopValue());
        feiri.next();
    }
    return counter.getCount();
}
Also used : BaseIteratorEnvironment(org.apache.accumulo.core.client.impl.BaseIteratorEnvironment) CountingIterator(org.apache.accumulo.core.iterators.system.CountingIterator) BaseIteratorEnvironment(org.apache.accumulo.core.client.impl.BaseIteratorEnvironment)

Aggregations

BaseIteratorEnvironment (org.apache.accumulo.core.client.impl.BaseIteratorEnvironment)1 CountingIterator (org.apache.accumulo.core.iterators.system.CountingIterator)1