Index: hbase-client/src/main/java/org/apache/hadoop/hbase/filter/InclusiveStopFilter.java =================================================================== --- hbase-client/src/main/java/org/apache/hadoop/hbase/filter/InclusiveStopFilter.java (revision 1566775) +++ hbase-client/src/main/java/org/apache/hadoop/hbase/filter/InclusiveStopFilter.java (working copy) @@ -24,7 +24,9 @@ import com.google.protobuf.HBaseZeroCopyByteString; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; +import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.exceptions.DeserializationException; +import org.apache.hadoop.hbase.filter.Filter.ReturnCode; import org.apache.hadoop.hbase.protobuf.generated.FilterProtos; import org.apache.hadoop.hbase.util.Bytes; @@ -51,6 +53,12 @@ return this.stopRowKey; } + @Override + public ReturnCode filterKeyValue(Cell v) { + if (done) return ReturnCode.SKIP; + return ReturnCode.INCLUDE; + } + public boolean filterRowKey(byte[] buffer, int offset, int length) { if (buffer == null) { //noinspection RedundantIfStatement Index: hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFilterListAdditional.java =================================================================== --- hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFilterListAdditional.java (revision 1566775) +++ hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFilterListAdditional.java (working copy) @@ -136,7 +136,35 @@ table.close(); } + /* + * When we do a "MUST_PASS_ONE" (a logical 'OR') of the two filters + * we expect to get the same result as the inclusive stop result. + */ + @Test + public void testFilterListWithInclusiveStopFilterMustPassOne() throws IOException { + String prefix = "Row C"; + HTable table = new HTable(TestFilterListAdditional.conf, tableName); + assertTrue("Fail to create the table", admin.tableExists(tableName)); + + FilterList flist = new FilterList(FilterList.Operator.MUST_PASS_ONE); + flist.addFilter(new AlwaysNextColFilter()); + flist.addFilter(new InclusiveStopFilter("Row CC".getBytes())); + + Scan scan = new Scan(); + scan.setStartRow(prefix.getBytes()); + scan.setFilter(flist); + + ResultScanner scanner = table.getScanner(scan); + + for (Result r: scanner){ + assertTrue("The rowid of this row does not start with \""+prefix+"\": "+r.toString(), + Bytes.toStringBinary(r.getRow()).startsWith(prefix)); + } + scanner.close(); + table.close(); + } + /* * When we do a "MUST_PASS_ONE" (a logical 'OR') of the above two filters * we expect to get the same result as the 'prefix' only result.