Search in sources :

Example 1 with ValueIterator

use of org.apache.accumulo.core.iterators.Combiner.ValueIterator in project accumulo by apache.

the class CombinerTest method valueIteratorTest.

@Test
public void valueIteratorTest() throws IOException {
    TreeMap<Key, Value> tm = new TreeMap<>();
    tm.put(new Key("r", "f", "q", 1), new Value("1".getBytes()));
    tm.put(new Key("r", "f", "q", 2), new Value("2".getBytes()));
    SortedMapIterator smi = new SortedMapIterator(tm);
    smi.seek(new Range(), EMPTY_COL_FAMS, false);
    ValueIterator iter = new ValueIterator(smi);
    assertEquals(iter.next().toString(), "2");
    assertEquals(iter.next().toString(), "1");
    assertFalse(iter.hasNext());
}
Also used : Value(org.apache.accumulo.core.data.Value) SortedKeyValueIterator(org.apache.accumulo.core.iterators.SortedKeyValueIterator) ValueIterator(org.apache.accumulo.core.iterators.Combiner.ValueIterator) TreeMap(java.util.TreeMap) SortedMapIterator(org.apache.accumulo.core.iterators.SortedMapIterator) Range(org.apache.accumulo.core.data.Range) Key(org.apache.accumulo.core.data.Key) Test(org.junit.Test)

Aggregations

TreeMap (java.util.TreeMap)1 Key (org.apache.accumulo.core.data.Key)1 Range (org.apache.accumulo.core.data.Range)1 Value (org.apache.accumulo.core.data.Value)1 ValueIterator (org.apache.accumulo.core.iterators.Combiner.ValueIterator)1 SortedKeyValueIterator (org.apache.accumulo.core.iterators.SortedKeyValueIterator)1 SortedMapIterator (org.apache.accumulo.core.iterators.SortedMapIterator)1 Test (org.junit.Test)1