HBASE-15247 InclusiveStopFilter does not respect reverse Filter property. (Amal Joshy)
This commit is contained in:
parent
2966eee602
commit
2d66cd86d0
|
@ -62,9 +62,7 @@ public class InclusiveStopFilter extends FilterBase {
|
|||
public boolean filterRowKey(Cell firstRowCell) {
|
||||
// if stopRowKey is <= buffer, then true, filter row.
|
||||
int cmp = CellComparator.COMPARATOR.compareRows(firstRowCell, stopRowKey, 0, stopRowKey.length);
|
||||
if (cmp > 0) {
|
||||
done = true;
|
||||
}
|
||||
done = reversed ? cmp < 0 : cmp > 0;
|
||||
return done;
|
||||
}
|
||||
|
||||
|
|
|
@ -716,6 +716,43 @@ public class TestFilter {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInclusiveStopFilterWithReverseScan() throws IOException {
|
||||
|
||||
// Grab rows from group one
|
||||
|
||||
// If we just use start/stop row, we get total/2 - 1 rows
|
||||
long expectedRows = (this.numRows / 2) - 1;
|
||||
long expectedKeys = this.colsPerRow;
|
||||
Scan s = new Scan(Bytes.toBytes("testRowOne-3"), Bytes.toBytes("testRowOne-0"));
|
||||
s.setReversed(true);
|
||||
verifyScan(s, expectedRows, expectedKeys);
|
||||
|
||||
// Now use start row with inclusive stop filter
|
||||
expectedRows = this.numRows / 2;
|
||||
s = new Scan(Bytes.toBytes("testRowOne-3"));
|
||||
s.setReversed(true);
|
||||
s.setFilter(new InclusiveStopFilter(Bytes.toBytes("testRowOne-0")));
|
||||
verifyScan(s, expectedRows, expectedKeys);
|
||||
|
||||
// Grab rows from group two
|
||||
|
||||
// If we just use start/stop row, we get total/2 - 1 rows
|
||||
expectedRows = (this.numRows / 2) - 1;
|
||||
expectedKeys = this.colsPerRow;
|
||||
s = new Scan(Bytes.toBytes("testRowTwo-3"), Bytes.toBytes("testRowTwo-0"));
|
||||
s.setReversed(true);
|
||||
verifyScan(s, expectedRows, expectedKeys);
|
||||
|
||||
// Now use start row with inclusive stop filter
|
||||
expectedRows = this.numRows / 2;
|
||||
s = new Scan(Bytes.toBytes("testRowTwo-3"));
|
||||
s.setReversed(true);
|
||||
s.setFilter(new InclusiveStopFilter(Bytes.toBytes("testRowTwo-0")));
|
||||
verifyScan(s, expectedRows, expectedKeys);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQualifierFilter() throws IOException {
|
||||
|
||||
|
|
Loading…
Reference in New Issue