use of org.apache.accumulo.core.iterators.SortedMapIterator in project accumulo by apache.
the class BigDecimalCombinerTest method testSums.
@Test
public void testSums() throws IOException {
ai = new BigDecimalCombiner.BigDecimalSummingCombiner();
IteratorSetting is = new IteratorSetting(1, BigDecimalCombiner.BigDecimalSummingCombiner.class);
Combiner.setColumns(is, columns);
ai.init(new SortedMapIterator(tm1), is.getOptions(), CombinerTest.SCAN_IE);
ai.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(ai.hasTop());
assertEquals(CombinerTest.newKey(1, 1, 1, 3), ai.getTopKey());
assertEquals(-9.7, encoder.decode(ai.getTopValue().get()).doubleValue(), delta);
verify();
}
use of org.apache.accumulo.core.iterators.SortedMapIterator in project accumulo by apache.
the class ColumnSliceFilterTest method testBothExclusive.
@Test
public void testBothExclusive() throws IOException {
ColumnSliceFilter.setSlice(is, "20080202", false, "20080204", false);
columnSliceFilter.validateOptions(is.getOptions());
columnSliceFilter.init(new SortedMapIterator(TEST_DATA), is.getOptions(), iteratorEnvironment);
columnSliceFilter.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_3));
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_6));
columnSliceFilter.next();
assertFalse(columnSliceFilter.hasTop());
}
use of org.apache.accumulo.core.iterators.SortedMapIterator in project accumulo by apache.
the class ColumnSliceFilterTest method testStartExclusiveEndInclusive.
@Test
public void testStartExclusiveEndInclusive() throws IOException {
ColumnSliceFilter.setSlice(is, "20080202", false, "20080204", true);
columnSliceFilter.validateOptions(is.getOptions());
columnSliceFilter.init(new SortedMapIterator(TEST_DATA), is.getOptions(), iteratorEnvironment);
columnSliceFilter.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_3));
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_6));
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_4));
columnSliceFilter.next();
assertFalse(columnSliceFilter.hasTop());
}
use of org.apache.accumulo.core.iterators.SortedMapIterator in project accumulo by apache.
the class ColumnSliceFilterTest method testBasic.
@Test
public void testBasic() throws IOException {
ColumnSliceFilter.setSlice(is, "20080202", "20080204");
assertTrue(columnSliceFilter.validateOptions(is.getOptions()));
columnSliceFilter.init(new SortedMapIterator(TEST_DATA), is.getOptions(), iteratorEnvironment);
columnSliceFilter.seek(new Range(), EMPTY_COL_FAMS, true);
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_2));
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_3));
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_6));
columnSliceFilter.next();
assertFalse(columnSliceFilter.hasTop());
}
use of org.apache.accumulo.core.iterators.SortedMapIterator in project accumulo by apache.
the class ColumnSliceFilterTest method testNullEnd.
@Test
public void testNullEnd() throws IOException {
ColumnSliceFilter.setSlice(is, "20080202", null);
columnSliceFilter.validateOptions(is.getOptions());
columnSliceFilter.init(new SortedMapIterator(TEST_DATA), is.getOptions(), iteratorEnvironment);
columnSliceFilter.seek(new Range(), EMPTY_COL_FAMS, false);
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_2));
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_3));
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_6));
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_4));
columnSliceFilter.next();
assertTrue(columnSliceFilter.hasTop());
assertTrue(columnSliceFilter.getTopKey().equals(KEY_5));
columnSliceFilter.next();
assertFalse(columnSliceFilter.hasTop());
}
Aggregations