Index: hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterList.java =================================================================== --- hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterList.java (revision 1590816) +++ hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterList.java (working copy) @@ -68,6 +68,7 @@ private Operator operator = Operator.MUST_PASS_ALL; private List filters = new ArrayList(); private Filter seekHintFilter = null; + private Boolean hasFilterRow = null; /** Reference Cell used by {@link #transformCell(Cell)} for validation purpose. */ private Cell referenceKV = null; @@ -173,6 +174,7 @@ filter.reset(); } seekHintFilter = null; + hasFilterRow = null; } @Override @@ -307,6 +309,9 @@ */ @Override public void filterRowCells(List ignored) throws IOException { + if (hasFilterRow != null && !hasFilterRow.booleanValue()) { + return; + } // Old filters based off of this class will override KeyValue transform(KeyValue). // Thus to maintain compatibility we need to call the old version. List kvs = new ArrayList(ignored.size()); @@ -326,6 +331,9 @@ @Override @Deprecated public void filterRow(List kvs) throws IOException { + if (hasFilterRow != null && !hasFilterRow.booleanValue()) { + return; + } // when removing this, this body should be in filterRowCells // convert to List and call the new interface (this will call 0.96-style @@ -345,16 +353,22 @@ @Override public boolean hasFilterRow() { + if (hasFilterRow != null) return hasFilterRow; for (Filter filter : filters) { - if(filter.hasFilterRow()) { - return true; + if (filter.hasFilterRow()) { + hasFilterRow = true; + break; } } - return false; + if (hasFilterRow == null) hasFilterRow = false; + return hasFilterRow; } @Override public boolean filterRow() throws IOException { + if (hasFilterRow != null && !hasFilterRow.booleanValue()) { + return false; + } for (Filter filter : filters) { if (operator == Operator.MUST_PASS_ALL) { if (filter.filterRow()) { @@ -366,7 +380,7 @@ } } } - return operator == Operator.MUST_PASS_ONE; + return operator == Operator.MUST_PASS_ONE; } /**