Search in sources :

Example 11 with SourceSwitchingIterator

use of org.apache.accumulo.core.iteratorsImpl.system.SourceSwitchingIterator in project accumulo by apache.

the class SourceSwitchingIteratorTest method test1.

@Test
public void test1() throws Exception {
    TreeMap<Key, Value> tm1 = new TreeMap<>();
    put(tm1, "r1", "cf1", "cq1", 5, "v1");
    put(tm1, "r1", "cf1", "cq3", 5, "v2");
    put(tm1, "r2", "cf1", "cq1", 5, "v3");
    SortedMapIterator smi = new SortedMapIterator(tm1);
    TestDataSource tds = new TestDataSource(smi);
    SourceSwitchingIterator ssi = new SourceSwitchingIterator(tds);
    ssi.seek(new Range(), new ArrayList<>(), false);
    testAndCallNext(ssi, "r1", "cf1", "cq1", 5, "v1", true);
    testAndCallNext(ssi, "r1", "cf1", "cq3", 5, "v2", true);
    testAndCallNext(ssi, "r2", "cf1", "cq1", 5, "v3", true);
    assertFalse(ssi.hasTop());
}
Also used : Value(org.apache.accumulo.core.data.Value) TreeMap(java.util.TreeMap) SortedMapIterator(org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator) SourceSwitchingIterator(org.apache.accumulo.core.iteratorsImpl.system.SourceSwitchingIterator) Range(org.apache.accumulo.core.data.Range) Key(org.apache.accumulo.core.data.Key) PartialKey(org.apache.accumulo.core.data.PartialKey) Test(org.junit.jupiter.api.Test)

Aggregations

SourceSwitchingIterator (org.apache.accumulo.core.iteratorsImpl.system.SourceSwitchingIterator)11 Key (org.apache.accumulo.core.data.Key)10 Value (org.apache.accumulo.core.data.Value)10 Range (org.apache.accumulo.core.data.Range)9 TreeMap (java.util.TreeMap)7 PartialKey (org.apache.accumulo.core.data.PartialKey)7 SortedMapIterator (org.apache.accumulo.core.iteratorsImpl.system.SortedMapIterator)7 Test (org.junit.jupiter.api.Test)7 IOException (java.io.IOException)3 DataFileValue (org.apache.accumulo.core.metadata.schema.DataFileValue)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 ByteSequence (org.apache.accumulo.core.data.ByteSequence)1 YieldCallback (org.apache.accumulo.core.iterators.YieldCallback)1 IterationInterruptedException (org.apache.accumulo.core.iteratorsImpl.system.IterationInterruptedException)1 ScanParameters (org.apache.accumulo.tserver.scan.ScanParameters)1