diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnCountGetFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnCountGetFilter.java index fd651307bfc..c747b00a3f3 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnCountGetFilter.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/ColumnCountGetFilter.java @@ -55,6 +55,7 @@ public class ColumnCountGetFilter extends FilterBase { @Override public boolean filterRowKey(Cell cell) throws IOException { // Impl in FilterBase might do unnecessary copy for Off heap backed Cells. + if (filterAllRemaining()) return true; return false; } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/Filter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/Filter.java index 22ca8ace58f..59aa85531c9 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/Filter.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/Filter.java @@ -87,6 +87,8 @@ public abstract class Filter { /** * Filters a row based on the row key. If this returns true, the entire row will be excluded. If * false, each KeyValue in the row will be passed to {@link #filterKeyValue(Cell)} below. + * If {@link #filterAllRemaining()} returns true, then {@link #filterRowKey(Cell)} should + * also return true. * * Concrete implementers can signal a failure condition in their code by throwing an * {@link IOException}. diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterBase.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterBase.java index fc00d026953..e59f3244e2d 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterBase.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterBase.java @@ -58,11 +58,13 @@ public abstract class FilterBase extends Filter { @Override @Deprecated public boolean filterRowKey(byte[] buffer, int offset, int length) throws IOException { + if (filterAllRemaining()) return true; return false; } @Override public boolean filterRowKey(Cell cell) throws IOException { + if (filterAllRemaining()) return true; return filterRowKey(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()); } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterWrapper.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterWrapper.java index 4d7a18a0679..617cd7a0564 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterWrapper.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterWrapper.java @@ -103,11 +103,13 @@ final public class FilterWrapper extends Filter { @Override public boolean filterRowKey(byte[] buffer, int offset, int length) throws IOException { // No call to this. + if (filterAllRemaining()) return true; return this.filter.filterRowKey(buffer, offset, length); } @Override public boolean filterRowKey(Cell cell) throws IOException { + if (filterAllRemaining()) return true; return this.filter.filterRowKey(cell); } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/InclusiveStopFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/InclusiveStopFilter.java index 1096f5e1bfe..5dcb50dd8b4 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/InclusiveStopFilter.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/InclusiveStopFilter.java @@ -61,6 +61,7 @@ public class InclusiveStopFilter extends FilterBase { public boolean filterRowKey(Cell firstRowCell) { // if stopRowKey is <= buffer, then true, filter row. + if (filterAllRemaining()) return true; int cmp = CellComparator.COMPARATOR.compareRows(firstRowCell, stopRowKey, 0, stopRowKey.length); done = reversed ? cmp < 0 : cmp > 0; return done; diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java index 5f9c8336f2e..3f26586845d 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/MultiRowRangeFilter.java @@ -85,6 +85,7 @@ public class MultiRowRangeFilter extends FilterBase { @Override public boolean filterRowKey(Cell firstRowCell) { + if (filterAllRemaining()) return true; // If it is the first time of running, calculate the current range index for // the row key. If index is out of bound which happens when the start row // user sets is after the largest stop row of the ranges, stop the scan. diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PageFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PageFilter.java index adc9c54c5eb..f12fac8929a 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PageFilter.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PageFilter.java @@ -63,6 +63,7 @@ public class PageFilter extends FilterBase { @Override public boolean filterRowKey(Cell cell) throws IOException { // Impl in FilterBase might do unnecessary copy for Off heap backed Cells. + if (filterAllRemaining()) return true; return false; } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PrefixFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PrefixFilter.java index d09ea2c8430..e7b91e1ee11 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PrefixFilter.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/PrefixFilter.java @@ -55,6 +55,7 @@ public class PrefixFilter extends FilterBase { public boolean filterRowKey(Cell firstRowCell) { if (firstRowCell == null || this.prefix == null) return true; + if (filterAllRemaining()) return true; int length = firstRowCell.getRowLength(); if (length < prefix.length) return true; // if they are equal, return false => pass row diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/WhileMatchFilter.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/WhileMatchFilter.java index e75ca49bdca..93b4a0058fc 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/WhileMatchFilter.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/filter/WhileMatchFilter.java @@ -74,6 +74,7 @@ public class WhileMatchFilter extends FilterBase { @Override public boolean filterRowKey(Cell cell) throws IOException { + if (filterAllRemaining()) return true; boolean value = filter.filterRowKey(cell); changeFAR(value); return value;