Search in sources :

Example 16 with MemoryIterator

use of org.apache.accumulo.tserver.InMemoryMap.MemoryIterator in project accumulo by apache.

the class InMemoryMapTest method testDifferentSampleConfig.

@Test(expected = SampleNotPresentException.class)
public void testDifferentSampleConfig() throws Exception {
    SamplerConfigurationImpl sampleConfig = new SamplerConfigurationImpl(RowSampler.class.getName(), ImmutableMap.of("hasher", "murmur3_32", "modulus", "7"));
    ConfigurationCopy config1 = newConfig(tempFolder.newFolder().getAbsolutePath());
    for (Entry<String, String> entry : sampleConfig.toTablePropertiesMap().entrySet()) {
        config1.set(entry.getKey(), entry.getValue());
    }
    InMemoryMap imm = new InMemoryMap(config1);
    mutate(imm, "r", "cf:cq", 5, "b");
    SamplerConfigurationImpl sampleConfig2 = new SamplerConfigurationImpl(RowSampler.class.getName(), ImmutableMap.of("hasher", "murmur3_32", "modulus", "9"));
    MemoryIterator iter = imm.skvIterator(sampleConfig2);
    iter.seek(new Range(), LocalityGroupUtil.EMPTY_CF_SET, false);
}
Also used : RowSampler(org.apache.accumulo.core.client.sample.RowSampler) ConfigurationCopy(org.apache.accumulo.core.conf.ConfigurationCopy) SamplerConfigurationImpl(org.apache.accumulo.core.sample.impl.SamplerConfigurationImpl) MemoryIterator(org.apache.accumulo.tserver.InMemoryMap.MemoryIterator) Range(org.apache.accumulo.core.data.Range) Test(org.junit.Test)

Example 17 with MemoryIterator

use of org.apache.accumulo.tserver.InMemoryMap.MemoryIterator in project accumulo by apache.

the class InMemoryMapTest method testDuplicateKey.

@Test
public void testDuplicateKey() throws Exception {
    InMemoryMap imm = newInMemoryMap(false, tempFolder.newFolder().getAbsolutePath());
    Mutation m = new Mutation(new Text("r1"));
    m.put(new Text("foo"), new Text("cq"), 3, new Value("v1".getBytes()));
    m.put(new Text("foo"), new Text("cq"), 3, new Value("v2".getBytes()));
    imm.mutate(Collections.singletonList(m));
    MemoryIterator skvi1 = imm.skvIterator(null);
    skvi1.seek(new Range(), LocalityGroupUtil.EMPTY_CF_SET, false);
    testAndCallNext(skvi1, "r1", "foo:cq", 3, "v2");
    testAndCallNext(skvi1, "r1", "foo:cq", 3, "v1");
}
Also used : Value(org.apache.accumulo.core.data.Value) MemoryIterator(org.apache.accumulo.tserver.InMemoryMap.MemoryIterator) Text(org.apache.hadoop.io.Text) Mutation(org.apache.accumulo.core.data.Mutation) Range(org.apache.accumulo.core.data.Range) Test(org.junit.Test)

Aggregations

MemoryIterator (org.apache.accumulo.tserver.InMemoryMap.MemoryIterator)17 Test (org.junit.Test)15 Range (org.apache.accumulo.core.data.Range)14 Value (org.apache.accumulo.core.data.Value)7 RowSampler (org.apache.accumulo.core.client.sample.RowSampler)6 Key (org.apache.accumulo.core.data.Key)6 SamplerConfigurationImpl (org.apache.accumulo.core.sample.impl.SamplerConfigurationImpl)6 ConfigurationCopy (org.apache.accumulo.core.conf.ConfigurationCopy)5 Text (org.apache.hadoop.io.Text)5 TreeMap (java.util.TreeMap)3 Sampler (org.apache.accumulo.core.client.sample.Sampler)3 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 Mutation (org.apache.accumulo.core.data.Mutation)2 ArrayList (java.util.ArrayList)1 ArrayByteSequence (org.apache.accumulo.core.data.ArrayByteSequence)1 ByteSequence (org.apache.accumulo.core.data.ByteSequence)1 IterationInterruptedException (org.apache.accumulo.core.iterators.IterationInterruptedException)1 ColumnFamilySkippingIterator (org.apache.accumulo.core.iterators.system.ColumnFamilySkippingIterator)1