HBASE-14397 PrefixFilter doesn't filter all remaining rows if the prefix is longer than rowkey being compared (Jianwei Cui)
This commit is contained in:
parent
dff5243c89
commit
36675c81fb
|
@ -40,9 +40,11 @@ import com.google.protobuf.InvalidProtocolBufferException;
|
|||
@InterfaceAudience.Public
|
||||
@InterfaceStability.Stable
|
||||
public class PrefixFilter extends FilterBase {
|
||||
public static final int MAX_SKIPPED_COMPARE_ROW_NUM = 100;
|
||||
protected byte [] prefix = null;
|
||||
protected boolean passedPrefix = false;
|
||||
protected boolean filterRow = true;
|
||||
protected int skippedCompareRows = 0;
|
||||
|
||||
public PrefixFilter(final byte [] prefix) {
|
||||
this.prefix = prefix;
|
||||
|
@ -56,7 +58,12 @@ public class PrefixFilter extends FilterBase {
|
|||
if (firstRowCell == null || this.prefix == null)
|
||||
return true;
|
||||
int length = firstRowCell.getRowLength();
|
||||
if (length < prefix.length) return true;
|
||||
if (length < prefix.length && skippedCompareRows < MAX_SKIPPED_COMPARE_ROW_NUM) {
|
||||
++skippedCompareRows;
|
||||
return true;
|
||||
}
|
||||
skippedCompareRows = 0;
|
||||
|
||||
// if they are equal, return false => pass row
|
||||
// else return true, filter row
|
||||
// if we are passed the prefix, set flag
|
||||
|
|
Loading…
Reference in New Issue