use of org.apache.accumulo.core.client.impl.BaseIteratorEnvironment 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();
}
use of org.apache.accumulo.core.client.impl.BaseIteratorEnvironment in project accumulo by apache.
the class SortedMapIteratorTest method testSampleNotPresent.
@Test(expected = SampleNotPresentException.class)
public void testSampleNotPresent() {
SortedMapIterator smi = new SortedMapIterator(new TreeMap<>());
smi.deepCopy(new BaseIteratorEnvironment() {
@Override
public boolean isSamplingEnabled() {
return true;
}
@Override
public SamplerConfiguration getSamplerConfiguration() {
return new SamplerConfiguration(RowSampler.class.getName());
}
});
}
use of org.apache.accumulo.core.client.impl.BaseIteratorEnvironment in project accumulo by apache.
the class MetadataBulkLoadFilterTest method testBasic.
@Test
public void testBasic() throws IOException {
TreeMap<Key, Value> tm1 = new TreeMap<>();
TreeMap<Key, Value> expected = new TreeMap<>();
// following should not be deleted by filter
put(tm1, "2;m", TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN, "/t1");
put(tm1, "2;m", DataFileColumnFamily.NAME, "/t1/file1", new DataFileValue(1, 1).encodeAsString());
put(tm1, "2;m", TabletsSection.BulkFileColumnFamily.NAME, "/t1/file1", "5");
put(tm1, "2;m", TabletsSection.BulkFileColumnFamily.NAME, "/t1/file3", "7");
put(tm1, "2;m", TabletsSection.BulkFileColumnFamily.NAME, "/t1/file4", "9");
put(tm1, "2<", TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN, "/t2");
put(tm1, "2<", DataFileColumnFamily.NAME, "/t2/file2", new DataFileValue(1, 1).encodeAsString());
put(tm1, "2<", TabletsSection.BulkFileColumnFamily.NAME, "/t2/file6", "5");
put(tm1, "2<", TabletsSection.BulkFileColumnFamily.NAME, "/t2/file7", "7");
put(tm1, "2<", TabletsSection.BulkFileColumnFamily.NAME, "/t2/file8", "9");
put(tm1, "2<", TabletsSection.BulkFileColumnFamily.NAME, "/t2/fileC", null);
expected.putAll(tm1);
// the following should be deleted by filter
put(tm1, "2;m", TabletsSection.BulkFileColumnFamily.NAME, "/t1/file5", "8");
put(tm1, "2<", TabletsSection.BulkFileColumnFamily.NAME, "/t2/file9", "8");
put(tm1, "2<", TabletsSection.BulkFileColumnFamily.NAME, "/t2/fileA", "2");
TestMetadataBulkLoadFilter iter = new TestMetadataBulkLoadFilter();
iter.init(new SortedMapIterator(tm1), new HashMap<>(), new BaseIteratorEnvironment() {
@Override
public boolean isFullMajorCompaction() {
return false;
}
@Override
public IteratorScope getIteratorScope() {
return IteratorScope.majc;
}
});
iter.seek(new Range(), new ArrayList<>(), false);
TreeMap<Key, Value> actual = new TreeMap<>();
while (iter.hasTop()) {
actual.put(iter.getTopKey(), iter.getTopValue());
iter.next();
}
Assert.assertEquals(expected, actual);
}
Aggregations