@Test
public void test3() throws IOException {
Value dv = new Value();
TreeMap<Key,Value> tm = new TreeMap<Key,Value>();
HashSet<Column> hsc = new HashSet<Column>();
hsc.add(new Column("c".getBytes(), null, null));
Text colf1 = new Text("a");
Text colq1 = new Text("b");
Text colf2 = new Text("c");
Text colq2 = new Text("d");
Text colf;
Text colq;
for (int i = 0; i < 1000; i++) {
if (Math.abs(Math.ceil(i / 2.0) - i / 2.0) < .001) {
colf = colf1;
colq = colq1;
} else {
colf = colf2;
colq = colq2;
}
Key k = new Key(new Text(String.format("%03d", i)), colf, colq);
k.setTimestamp(157l);
tm.put(k, dv);
}
assertTrue(tm.size() == 1000);
ColumnQualifierFilter a = new ColumnQualifierFilter(new SortedMapIterator(tm), hsc);
a.seek(new Range(), EMPTY_COL_FAMS, false);
assertEquals(size(a), 1000);
hsc = new HashSet<Column>();
hsc.add(new Column("a".getBytes(), "b".getBytes(), null));
a = new ColumnQualifierFilter(new SortedMapIterator(tm), hsc);
a.seek(new Range(), EMPTY_COL_FAMS, false);
int size = size(a);
assertTrue("size was " + size, size == 500);