HBASE-18769 Make CompareFilter use generic CompareOperator instead of
internal enum
This commit is contained in:
parent
4ad47ccd93
commit
7f70b6c8e3
|
@ -134,8 +134,7 @@ public interface Table extends Closeable {
|
||||||
*/
|
*/
|
||||||
<R> void batchCallback(
|
<R> void batchCallback(
|
||||||
final List<? extends Row> actions, final Object[] results, final Batch.Callback<R> callback
|
final List<? extends Row> actions, final Object[] results, final Batch.Callback<R> callback
|
||||||
)
|
) throws IOException, InterruptedException;
|
||||||
throws IOException, InterruptedException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts certain cells from a given row.
|
* Extracts certain cells from a given row.
|
||||||
|
|
|
@ -54,8 +54,9 @@ public abstract class CompareFilter extends FilterBase {
|
||||||
* Comparison operators. For filters only!
|
* Comparison operators. For filters only!
|
||||||
* Use {@link CompareOperator} otherwise.
|
* Use {@link CompareOperator} otherwise.
|
||||||
* It (intentionally) has at least the below enums with same names.
|
* It (intentionally) has at least the below enums with same names.
|
||||||
* TODO: Replace with generic {@link CompareOperator}
|
* @deprecated since 2.0.0. Will be removed in 3.0.0. Use {@link CompareOperator} instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@InterfaceAudience.Public
|
@InterfaceAudience.Public
|
||||||
public enum CompareOp {
|
public enum CompareOp {
|
||||||
/** less than */
|
/** less than */
|
||||||
|
@ -74,25 +75,43 @@ public abstract class CompareFilter extends FilterBase {
|
||||||
NO_OP,
|
NO_OP,
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CompareOp compareOp;
|
protected CompareOperator op;
|
||||||
protected ByteArrayComparable comparator;
|
protected ByteArrayComparable comparator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
* @param compareOp the compare op for row matching
|
* @param compareOp the compare op for row matching
|
||||||
* @param comparator the comparator for row matching
|
* @param comparator the comparator for row matching
|
||||||
|
* @deprecated Since 2.0.0. Will be removed in 3.0.0. Use other constructor.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public CompareFilter(final CompareOp compareOp,
|
public CompareFilter(final CompareOp compareOp,
|
||||||
final ByteArrayComparable comparator) {
|
final ByteArrayComparable comparator) {
|
||||||
this.compareOp = compareOp;
|
this(CompareOperator.valueOf(compareOp.name()), comparator);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
* @param op the compare op for row matching
|
||||||
|
* @param comparator the comparator for row matching
|
||||||
|
*/
|
||||||
|
public CompareFilter(final CompareOperator op,
|
||||||
|
final ByteArrayComparable comparator) {
|
||||||
|
this.op = op;
|
||||||
this.comparator = comparator;
|
this.comparator = comparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return operator
|
* @return operator
|
||||||
|
* @deprecated since 2.0.0. Will be removed in 3.0.0. Use {@link #getCompareOperator()} instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public CompareOp getOperator() {
|
public CompareOp getOperator() {
|
||||||
return compareOp;
|
return CompareOp.valueOf(op.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompareOperator getCompareOperator() {
|
||||||
|
return op;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,6 +127,11 @@ public abstract class CompareFilter extends FilterBase {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Since 2.0.0. Will be removed in 3.0.0.
|
||||||
|
* Use {@link #compareRow(CompareOperator, ByteArrayComparable, Cell)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
protected boolean compareRow(final CompareOp compareOp, final ByteArrayComparable comparator,
|
protected boolean compareRow(final CompareOp compareOp, final ByteArrayComparable comparator,
|
||||||
final Cell cell) {
|
final Cell cell) {
|
||||||
if (compareOp == CompareOp.NO_OP) {
|
if (compareOp == CompareOp.NO_OP) {
|
||||||
|
@ -117,6 +141,20 @@ public abstract class CompareFilter extends FilterBase {
|
||||||
return compare(compareOp, compareResult);
|
return compare(compareOp, compareResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean compareRow(final CompareOperator op, final ByteArrayComparable comparator,
|
||||||
|
final Cell cell) {
|
||||||
|
if (op == CompareOperator.NO_OP) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
int compareResult = CellComparator.compareRow(cell, comparator);
|
||||||
|
return compare(op, compareResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Since 2.0.0. Will be removed in 3.0.0.
|
||||||
|
* Use {@link #compareFamily(CompareOperator, ByteArrayComparable, Cell)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
protected boolean compareFamily(final CompareOp compareOp, final ByteArrayComparable comparator,
|
protected boolean compareFamily(final CompareOp compareOp, final ByteArrayComparable comparator,
|
||||||
final Cell cell) {
|
final Cell cell) {
|
||||||
if (compareOp == CompareOp.NO_OP) {
|
if (compareOp == CompareOp.NO_OP) {
|
||||||
|
@ -126,8 +164,23 @@ public abstract class CompareFilter extends FilterBase {
|
||||||
return compare(compareOp, compareResult);
|
return compare(compareOp, compareResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean compareFamily(final CompareOperator op, final ByteArrayComparable comparator,
|
||||||
|
final Cell cell) {
|
||||||
|
if (op == CompareOperator.NO_OP) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
int compareResult = CellComparator.compareFamily(cell, comparator);
|
||||||
|
return compare(op, compareResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Since 2.0.0. Will be removed in 3.0.0.
|
||||||
|
* Use {@link #compareQualifier(CompareOperator, ByteArrayComparable, Cell)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
protected boolean compareQualifier(final CompareOp compareOp,
|
protected boolean compareQualifier(final CompareOp compareOp,
|
||||||
final ByteArrayComparable comparator, final Cell cell) {
|
final ByteArrayComparable comparator, final Cell cell) {
|
||||||
|
// We do not call through to the non-deprecated method for perf reasons.
|
||||||
if (compareOp == CompareOp.NO_OP) {
|
if (compareOp == CompareOp.NO_OP) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -135,8 +188,24 @@ public abstract class CompareFilter extends FilterBase {
|
||||||
return compare(compareOp, compareResult);
|
return compare(compareOp, compareResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean compareQualifier(final CompareOperator op,
|
||||||
|
final ByteArrayComparable comparator, final Cell cell) {
|
||||||
|
// We do not call through to the non-deprecated method for perf reasons.
|
||||||
|
if (op == CompareOperator.NO_OP) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
int compareResult = CellComparator.compareQualifier(cell, comparator);
|
||||||
|
return compare(op, compareResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Since 2.0.0. Will be removed in 3.0.0.
|
||||||
|
* Use {@link #compareValue(CompareOperator, ByteArrayComparable, Cell)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
protected boolean compareValue(final CompareOp compareOp, final ByteArrayComparable comparator,
|
protected boolean compareValue(final CompareOp compareOp, final ByteArrayComparable comparator,
|
||||||
final Cell cell) {
|
final Cell cell) {
|
||||||
|
// We do not call through to the non-deprecated method for perf reasons.
|
||||||
if (compareOp == CompareOp.NO_OP) {
|
if (compareOp == CompareOp.NO_OP) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -144,8 +213,17 @@ public abstract class CompareFilter extends FilterBase {
|
||||||
return compare(compareOp, compareResult);
|
return compare(compareOp, compareResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean compare(final CompareOp compareOp, int compareResult) {
|
protected boolean compareValue(final CompareOperator op, final ByteArrayComparable comparator,
|
||||||
switch (compareOp) {
|
final Cell cell) {
|
||||||
|
if (op == CompareOperator.NO_OP) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
int compareResult = CellComparator.compareValue(cell, comparator);
|
||||||
|
return compare(op, compareResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean compare(final CompareOp op, int compareResult) {
|
||||||
|
switch (op) {
|
||||||
case LESS:
|
case LESS:
|
||||||
return compareResult <= 0;
|
return compareResult <= 0;
|
||||||
case LESS_OR_EQUAL:
|
case LESS_OR_EQUAL:
|
||||||
|
@ -159,7 +237,26 @@ public abstract class CompareFilter extends FilterBase {
|
||||||
case GREATER:
|
case GREATER:
|
||||||
return compareResult >= 0;
|
return compareResult >= 0;
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("Unknown Compare op " + compareOp.name());
|
throw new RuntimeException("Unknown Compare op " + op.name());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean compare(final CompareOperator op, int compareResult) {
|
||||||
|
switch (op) {
|
||||||
|
case LESS:
|
||||||
|
return compareResult <= 0;
|
||||||
|
case LESS_OR_EQUAL:
|
||||||
|
return compareResult < 0;
|
||||||
|
case EQUAL:
|
||||||
|
return compareResult != 0;
|
||||||
|
case NOT_EQUAL:
|
||||||
|
return compareResult == 0;
|
||||||
|
case GREATER_OR_EQUAL:
|
||||||
|
return compareResult > 0;
|
||||||
|
case GREATER:
|
||||||
|
return compareResult >= 0;
|
||||||
|
default:
|
||||||
|
throw new RuntimeException("Unknown Compare op " + op.name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,20 +264,20 @@ public abstract class CompareFilter extends FilterBase {
|
||||||
public static ArrayList<Object> extractArguments(ArrayList<byte []> filterArguments) {
|
public static ArrayList<Object> extractArguments(ArrayList<byte []> filterArguments) {
|
||||||
Preconditions.checkArgument(filterArguments.size() == 2,
|
Preconditions.checkArgument(filterArguments.size() == 2,
|
||||||
"Expected 2 but got: %s", filterArguments.size());
|
"Expected 2 but got: %s", filterArguments.size());
|
||||||
CompareOp compareOp = ParseFilter.createCompareOp(filterArguments.get(0));
|
CompareOperator op = ParseFilter.createCompareOperator(filterArguments.get(0));
|
||||||
ByteArrayComparable comparator = ParseFilter.createComparator(
|
ByteArrayComparable comparator = ParseFilter.createComparator(
|
||||||
ParseFilter.removeQuotesFromByteArray(filterArguments.get(1)));
|
ParseFilter.removeQuotesFromByteArray(filterArguments.get(1)));
|
||||||
|
|
||||||
if (comparator instanceof RegexStringComparator ||
|
if (comparator instanceof RegexStringComparator ||
|
||||||
comparator instanceof SubstringComparator) {
|
comparator instanceof SubstringComparator) {
|
||||||
if (compareOp != CompareOp.EQUAL &&
|
if (op != CompareOperator.EQUAL &&
|
||||||
compareOp != CompareOp.NOT_EQUAL) {
|
op != CompareOperator.NOT_EQUAL) {
|
||||||
throw new IllegalArgumentException ("A regexstring comparator and substring comparator" +
|
throw new IllegalArgumentException ("A regexstring comparator and substring comparator" +
|
||||||
" can only be used with EQUAL and NOT_EQUAL");
|
" can only be used with EQUAL and NOT_EQUAL");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ArrayList<Object> arguments = new ArrayList<>(2);
|
ArrayList<Object> arguments = new ArrayList<>(2);
|
||||||
arguments.add(compareOp);
|
arguments.add(op);
|
||||||
arguments.add(comparator);
|
arguments.add(comparator);
|
||||||
return arguments;
|
return arguments;
|
||||||
}
|
}
|
||||||
|
@ -191,7 +288,7 @@ public abstract class CompareFilter extends FilterBase {
|
||||||
FilterProtos.CompareFilter convert() {
|
FilterProtos.CompareFilter convert() {
|
||||||
FilterProtos.CompareFilter.Builder builder =
|
FilterProtos.CompareFilter.Builder builder =
|
||||||
FilterProtos.CompareFilter.newBuilder();
|
FilterProtos.CompareFilter.newBuilder();
|
||||||
HBaseProtos.CompareType compareOp = CompareType.valueOf(this.compareOp.name());
|
HBaseProtos.CompareType compareOp = CompareType.valueOf(this.op.name());
|
||||||
builder.setCompareOp(compareOp);
|
builder.setCompareOp(compareOp);
|
||||||
if (this.comparator != null) builder.setComparator(ProtobufUtil.toComparator(this.comparator));
|
if (this.comparator != null) builder.setComparator(ProtobufUtil.toComparator(this.comparator));
|
||||||
return builder.build();
|
return builder.build();
|
||||||
|
@ -206,9 +303,8 @@ public abstract class CompareFilter extends FilterBase {
|
||||||
boolean areSerializedFieldsEqual(Filter o) {
|
boolean areSerializedFieldsEqual(Filter o) {
|
||||||
if (o == this) return true;
|
if (o == this) return true;
|
||||||
if (!(o instanceof CompareFilter)) return false;
|
if (!(o instanceof CompareFilter)) return false;
|
||||||
|
|
||||||
CompareFilter other = (CompareFilter)o;
|
CompareFilter other = (CompareFilter)o;
|
||||||
return this.getOperator().equals(other.getOperator()) &&
|
return this.getCompareOperator().equals(other.getCompareOperator()) &&
|
||||||
(this.getComparator() == other.getComparator()
|
(this.getComparator() == other.getComparator()
|
||||||
|| this.getComparator().areSerializedFieldsEqual(other.getComparator()));
|
|| this.getComparator().areSerializedFieldsEqual(other.getComparator()));
|
||||||
}
|
}
|
||||||
|
@ -217,7 +313,7 @@ public abstract class CompareFilter extends FilterBase {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("%s (%s, %s)",
|
return String.format("%s (%s, %s)",
|
||||||
this.getClass().getSimpleName(),
|
this.getClass().getSimpleName(),
|
||||||
this.compareOp.name(),
|
this.op.name(),
|
||||||
Bytes.toStringBinary(this.comparator.getValue()));
|
Bytes.toStringBinary(this.comparator.getValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Set;
|
||||||
|
|
||||||
import org.apache.hadoop.hbase.Cell;
|
import org.apache.hadoop.hbase.Cell;
|
||||||
import org.apache.hadoop.hbase.CellUtil;
|
import org.apache.hadoop.hbase.CellUtil;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.exceptions.DeserializationException;
|
import org.apache.hadoop.hbase.exceptions.DeserializationException;
|
||||||
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
|
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
|
||||||
|
@ -64,12 +65,35 @@ public class DependentColumnFilter extends CompareFilter {
|
||||||
* @param dropDependentColumn whether the column should be discarded after
|
* @param dropDependentColumn whether the column should be discarded after
|
||||||
* @param valueCompareOp comparison op
|
* @param valueCompareOp comparison op
|
||||||
* @param valueComparator comparator
|
* @param valueComparator comparator
|
||||||
|
* @deprecated Since 2.0.0. Will be removed in 3.0.0. Use
|
||||||
|
* {@link #DependentColumnFilter(byte[], byte[], boolean, CompareOperator, ByteArrayComparable)}
|
||||||
|
* instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public DependentColumnFilter(final byte [] family, final byte[] qualifier,
|
public DependentColumnFilter(final byte [] family, final byte[] qualifier,
|
||||||
final boolean dropDependentColumn, final CompareOp valueCompareOp,
|
final boolean dropDependentColumn, final CompareOp valueCompareOp,
|
||||||
final ByteArrayComparable valueComparator) {
|
final ByteArrayComparable valueComparator) {
|
||||||
// set up the comparator
|
this(family, qualifier, dropDependentColumn, CompareOperator.valueOf(valueCompareOp.name()),
|
||||||
super(valueCompareOp, valueComparator);
|
valueComparator);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build a dependent column filter with value checking
|
||||||
|
* dependent column varies will be compared using the supplied
|
||||||
|
* compareOp and comparator, for usage of which
|
||||||
|
* refer to {@link CompareFilter}
|
||||||
|
*
|
||||||
|
* @param family dependent column family
|
||||||
|
* @param qualifier dependent column qualifier
|
||||||
|
* @param dropDependentColumn whether the column should be discarded after
|
||||||
|
* @param op Value comparison op
|
||||||
|
* @param valueComparator comparator
|
||||||
|
*/
|
||||||
|
public DependentColumnFilter(final byte [] family, final byte[] qualifier,
|
||||||
|
final boolean dropDependentColumn, final CompareOperator op,
|
||||||
|
final ByteArrayComparable valueComparator) {
|
||||||
|
// set up the comparator
|
||||||
|
super(op, valueComparator);
|
||||||
this.columnFamily = family;
|
this.columnFamily = family;
|
||||||
this.columnQualifier = qualifier;
|
this.columnQualifier = qualifier;
|
||||||
this.dropDependentColumn = dropDependentColumn;
|
this.dropDependentColumn = dropDependentColumn;
|
||||||
|
@ -140,7 +164,7 @@ public class DependentColumnFilter extends CompareFilter {
|
||||||
}
|
}
|
||||||
// If it doesn't pass the op, skip it
|
// If it doesn't pass the op, skip it
|
||||||
if (comparator != null
|
if (comparator != null
|
||||||
&& compareValue(compareOp, comparator, c))
|
&& compareValue(getCompareOperator(), comparator, c))
|
||||||
return ReturnCode.SKIP;
|
return ReturnCode.SKIP;
|
||||||
|
|
||||||
stampSet.add(c.getTimestamp());
|
stampSet.add(c.getTimestamp());
|
||||||
|
@ -194,11 +218,11 @@ public class DependentColumnFilter extends CompareFilter {
|
||||||
byte [] family = ParseFilter.removeQuotesFromByteArray(filterArguments.get(0));
|
byte [] family = ParseFilter.removeQuotesFromByteArray(filterArguments.get(0));
|
||||||
byte [] qualifier = ParseFilter.removeQuotesFromByteArray(filterArguments.get(1));
|
byte [] qualifier = ParseFilter.removeQuotesFromByteArray(filterArguments.get(1));
|
||||||
boolean dropDependentColumn = ParseFilter.convertByteArrayToBoolean(filterArguments.get(2));
|
boolean dropDependentColumn = ParseFilter.convertByteArrayToBoolean(filterArguments.get(2));
|
||||||
CompareOp compareOp = ParseFilter.createCompareOp(filterArguments.get(3));
|
CompareOperator op = ParseFilter.createCompareOperator(filterArguments.get(3));
|
||||||
ByteArrayComparable comparator = ParseFilter.createComparator(
|
ByteArrayComparable comparator = ParseFilter.createComparator(
|
||||||
ParseFilter.removeQuotesFromByteArray(filterArguments.get(4)));
|
ParseFilter.removeQuotesFromByteArray(filterArguments.get(4)));
|
||||||
return new DependentColumnFilter(family, qualifier, dropDependentColumn,
|
return new DependentColumnFilter(family, qualifier, dropDependentColumn,
|
||||||
compareOp, comparator);
|
op, comparator);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Expected 2, 3 or 5 but got: " + filterArguments.size());
|
throw new IllegalArgumentException("Expected 2, 3 or 5 but got: " + filterArguments.size());
|
||||||
}
|
}
|
||||||
|
@ -235,8 +259,8 @@ public class DependentColumnFilter extends CompareFilter {
|
||||||
} catch (InvalidProtocolBufferException e) {
|
} catch (InvalidProtocolBufferException e) {
|
||||||
throw new DeserializationException(e);
|
throw new DeserializationException(e);
|
||||||
}
|
}
|
||||||
final CompareOp valueCompareOp =
|
final CompareOperator valueCompareOp =
|
||||||
CompareOp.valueOf(proto.getCompareFilter().getCompareOp().name());
|
CompareOperator.valueOf(proto.getCompareFilter().getCompareOp().name());
|
||||||
ByteArrayComparable valueComparator = null;
|
ByteArrayComparable valueComparator = null;
|
||||||
try {
|
try {
|
||||||
if (proto.getCompareFilter().hasComparator()) {
|
if (proto.getCompareFilter().hasComparator()) {
|
||||||
|
@ -276,7 +300,7 @@ public class DependentColumnFilter extends CompareFilter {
|
||||||
Bytes.toStringBinary(this.columnFamily),
|
Bytes.toStringBinary(this.columnFamily),
|
||||||
Bytes.toStringBinary(this.columnQualifier),
|
Bytes.toStringBinary(this.columnQualifier),
|
||||||
this.dropDependentColumn,
|
this.dropDependentColumn,
|
||||||
this.compareOp.name(),
|
this.op.name(),
|
||||||
this.comparator != null ? Bytes.toStringBinary(this.comparator.getValue()) : "null");
|
this.comparator != null ? Bytes.toStringBinary(this.comparator.getValue()) : "null");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.apache.hadoop.hbase.Cell;
|
import org.apache.hadoop.hbase.Cell;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.exceptions.DeserializationException;
|
import org.apache.hadoop.hbase.exceptions.DeserializationException;
|
||||||
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
|
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
|
||||||
|
@ -51,17 +52,31 @@ public class FamilyFilter extends CompareFilter {
|
||||||
*
|
*
|
||||||
* @param familyCompareOp the compare op for column family matching
|
* @param familyCompareOp the compare op for column family matching
|
||||||
* @param familyComparator the comparator for column family matching
|
* @param familyComparator the comparator for column family matching
|
||||||
|
* @deprecated Since 2.0.0. Will be removed in 3.0.0.
|
||||||
|
* Use {@link #FamilyFilter(CompareOperator, ByteArrayComparable)}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public FamilyFilter(final CompareOp familyCompareOp,
|
public FamilyFilter(final CompareOp familyCompareOp,
|
||||||
final ByteArrayComparable familyComparator) {
|
final ByteArrayComparable familyComparator) {
|
||||||
super(familyCompareOp, familyComparator);
|
super(familyCompareOp, familyComparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param op the compare op for column family matching
|
||||||
|
* @param familyComparator the comparator for column family matching
|
||||||
|
*/
|
||||||
|
public FamilyFilter(final CompareOperator op,
|
||||||
|
final ByteArrayComparable familyComparator) {
|
||||||
|
super(op, familyComparator);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReturnCode filterKeyValue(Cell v) {
|
public ReturnCode filterKeyValue(Cell v) {
|
||||||
int familyLength = v.getFamilyLength();
|
int familyLength = v.getFamilyLength();
|
||||||
if (familyLength > 0) {
|
if (familyLength > 0) {
|
||||||
if (compareFamily(this.compareOp, this.comparator, v)) {
|
if (compareFamily(getCompareOperator(), this.comparator, v)) {
|
||||||
return ReturnCode.NEXT_ROW;
|
return ReturnCode.NEXT_ROW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +85,7 @@ public class FamilyFilter extends CompareFilter {
|
||||||
|
|
||||||
public static Filter createFilterFromArguments(ArrayList<byte []> filterArguments) {
|
public static Filter createFilterFromArguments(ArrayList<byte []> filterArguments) {
|
||||||
ArrayList<?> arguments = CompareFilter.extractArguments(filterArguments);
|
ArrayList<?> arguments = CompareFilter.extractArguments(filterArguments);
|
||||||
CompareOp compareOp = (CompareOp)arguments.get(0);
|
CompareOperator compareOp = (CompareOperator)arguments.get(0);
|
||||||
ByteArrayComparable comparator = (ByteArrayComparable)arguments.get(1);
|
ByteArrayComparable comparator = (ByteArrayComparable)arguments.get(1);
|
||||||
return new FamilyFilter(compareOp, comparator);
|
return new FamilyFilter(compareOp, comparator);
|
||||||
}
|
}
|
||||||
|
@ -99,8 +114,8 @@ public class FamilyFilter extends CompareFilter {
|
||||||
} catch (InvalidProtocolBufferException e) {
|
} catch (InvalidProtocolBufferException e) {
|
||||||
throw new DeserializationException(e);
|
throw new DeserializationException(e);
|
||||||
}
|
}
|
||||||
final CompareOp valueCompareOp =
|
final CompareOperator valueCompareOp =
|
||||||
CompareOp.valueOf(proto.getCompareFilter().getCompareOp().name());
|
CompareOperator.valueOf(proto.getCompareFilter().getCompareOp().name());
|
||||||
ByteArrayComparable valueComparator = null;
|
ByteArrayComparable valueComparator = null;
|
||||||
try {
|
try {
|
||||||
if (proto.getCompareFilter().hasComparator()) {
|
if (proto.getCompareFilter().hasComparator()) {
|
||||||
|
@ -113,7 +128,6 @@ public class FamilyFilter extends CompareFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param other
|
|
||||||
* @return true if and only if the fields of the filter that are serialized
|
* @return true if and only if the fields of the filter that are serialized
|
||||||
* are equal to the corresponding fields in other. Used for testing.
|
* are equal to the corresponding fields in other. Used for testing.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -32,6 +32,7 @@ import java.util.Stack;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
|
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
|
||||||
import org.apache.hadoop.hbase.util.Bytes;
|
import org.apache.hadoop.hbase.util.Bytes;
|
||||||
|
@ -765,12 +766,40 @@ public class ParseFilter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes a compareOperator symbol as a byte array and returns the corresponding CompareOperator
|
* Takes a compareOperator symbol as a byte array and returns the corresponding CompareOperator
|
||||||
* <p>
|
* @deprecated Since 2.0
|
||||||
* @param compareOpAsByteArray the comparatorOperator symbol as a byte array
|
* <p>
|
||||||
* @return the Compare Operator
|
* @param compareOpAsByteArray the comparatorOperator symbol as a byte array
|
||||||
*/
|
* @return the Compare Operator
|
||||||
|
*/
|
||||||
|
public static CompareOperator createCompareOperator (byte [] compareOpAsByteArray) {
|
||||||
|
ByteBuffer compareOp = ByteBuffer.wrap(compareOpAsByteArray);
|
||||||
|
if (compareOp.equals(ParseConstants.LESS_THAN_BUFFER))
|
||||||
|
return CompareOperator.LESS;
|
||||||
|
else if (compareOp.equals(ParseConstants.LESS_THAN_OR_EQUAL_TO_BUFFER))
|
||||||
|
return CompareOperator.LESS_OR_EQUAL;
|
||||||
|
else if (compareOp.equals(ParseConstants.GREATER_THAN_BUFFER))
|
||||||
|
return CompareOperator.GREATER;
|
||||||
|
else if (compareOp.equals(ParseConstants.GREATER_THAN_OR_EQUAL_TO_BUFFER))
|
||||||
|
return CompareOperator.GREATER_OR_EQUAL;
|
||||||
|
else if (compareOp.equals(ParseConstants.NOT_EQUAL_TO_BUFFER))
|
||||||
|
return CompareOperator.NOT_EQUAL;
|
||||||
|
else if (compareOp.equals(ParseConstants.EQUAL_TO_BUFFER))
|
||||||
|
return CompareOperator.EQUAL;
|
||||||
|
else
|
||||||
|
throw new IllegalArgumentException("Invalid compare operator");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes a compareOperator symbol as a byte array and returns the corresponding CompareOperator
|
||||||
|
* @deprecated Since 2.0
|
||||||
|
* <p>
|
||||||
|
* @param compareOpAsByteArray the comparatorOperator symbol as a byte array
|
||||||
|
* @return the Compare Operator
|
||||||
|
* @deprecated Since 2.0.0. Will be removed in 3.0.0. Use {@link #createCompareOperator(byte [])}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public static CompareFilter.CompareOp createCompareOp (byte [] compareOpAsByteArray) {
|
public static CompareFilter.CompareOp createCompareOp (byte [] compareOpAsByteArray) {
|
||||||
ByteBuffer compareOp = ByteBuffer.wrap(compareOpAsByteArray);
|
ByteBuffer compareOp = ByteBuffer.wrap(compareOpAsByteArray);
|
||||||
if (compareOp.equals(ParseConstants.LESS_THAN_BUFFER))
|
if (compareOp.equals(ParseConstants.LESS_THAN_BUFFER))
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.apache.hadoop.hbase.Cell;
|
import org.apache.hadoop.hbase.Cell;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.exceptions.DeserializationException;
|
import org.apache.hadoop.hbase.exceptions.DeserializationException;
|
||||||
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
|
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
|
||||||
|
@ -50,17 +51,30 @@ public class QualifierFilter extends CompareFilter {
|
||||||
* Constructor.
|
* Constructor.
|
||||||
* @param op the compare op for column qualifier matching
|
* @param op the compare op for column qualifier matching
|
||||||
* @param qualifierComparator the comparator for column qualifier matching
|
* @param qualifierComparator the comparator for column qualifier matching
|
||||||
|
* @deprecated Since 2.0.0. Will be removed in 3.0.0.
|
||||||
|
* Use {@link #QualifierFilter(CompareOperator, ByteArrayComparable)} instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public QualifierFilter(final CompareOp op,
|
public QualifierFilter(final CompareOp op,
|
||||||
final ByteArrayComparable qualifierComparator) {
|
final ByteArrayComparable qualifierComparator) {
|
||||||
super(op, qualifierComparator);
|
super(op, qualifierComparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
* @param op the compare op for column qualifier matching
|
||||||
|
* @param qualifierComparator the comparator for column qualifier matching
|
||||||
|
*/
|
||||||
|
public QualifierFilter(final CompareOperator op,
|
||||||
|
final ByteArrayComparable qualifierComparator) {
|
||||||
|
super(op, qualifierComparator);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReturnCode filterKeyValue(Cell v) {
|
public ReturnCode filterKeyValue(Cell v) {
|
||||||
int qualifierLength = v.getQualifierLength();
|
int qualifierLength = v.getQualifierLength();
|
||||||
if (qualifierLength > 0) {
|
if (qualifierLength > 0) {
|
||||||
if (compareQualifier(this.compareOp, this.comparator, v)) {
|
if (compareQualifier(getCompareOperator(), this.comparator, v)) {
|
||||||
return ReturnCode.SKIP;
|
return ReturnCode.SKIP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +83,7 @@ public class QualifierFilter extends CompareFilter {
|
||||||
|
|
||||||
public static Filter createFilterFromArguments(ArrayList<byte []> filterArguments) {
|
public static Filter createFilterFromArguments(ArrayList<byte []> filterArguments) {
|
||||||
ArrayList<?> arguments = CompareFilter.extractArguments(filterArguments);
|
ArrayList<?> arguments = CompareFilter.extractArguments(filterArguments);
|
||||||
CompareOp compareOp = (CompareOp)arguments.get(0);
|
CompareOperator compareOp = (CompareOperator)arguments.get(0);
|
||||||
ByteArrayComparable comparator = (ByteArrayComparable)arguments.get(1);
|
ByteArrayComparable comparator = (ByteArrayComparable)arguments.get(1);
|
||||||
return new QualifierFilter(compareOp, comparator);
|
return new QualifierFilter(compareOp, comparator);
|
||||||
}
|
}
|
||||||
|
@ -98,8 +112,8 @@ public class QualifierFilter extends CompareFilter {
|
||||||
} catch (InvalidProtocolBufferException e) {
|
} catch (InvalidProtocolBufferException e) {
|
||||||
throw new DeserializationException(e);
|
throw new DeserializationException(e);
|
||||||
}
|
}
|
||||||
final CompareOp valueCompareOp =
|
final CompareOperator valueCompareOp =
|
||||||
CompareOp.valueOf(proto.getCompareFilter().getCompareOp().name());
|
CompareOperator.valueOf(proto.getCompareFilter().getCompareOp().name());
|
||||||
ByteArrayComparable valueComparator = null;
|
ByteArrayComparable valueComparator = null;
|
||||||
try {
|
try {
|
||||||
if (proto.getCompareFilter().hasComparator()) {
|
if (proto.getCompareFilter().hasComparator()) {
|
||||||
|
@ -112,7 +126,6 @@ public class QualifierFilter extends CompareFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param other
|
|
||||||
* @return true if and only if the fields of the filter that are serialized
|
* @return true if and only if the fields of the filter that are serialized
|
||||||
* are equal to the corresponding fields in other. Used for testing.
|
* are equal to the corresponding fields in other. Used for testing.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.apache.hadoop.hbase.Cell;
|
import org.apache.hadoop.hbase.Cell;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.exceptions.DeserializationException;
|
import org.apache.hadoop.hbase.exceptions.DeserializationException;
|
||||||
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
|
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
|
||||||
|
@ -51,12 +52,25 @@ public class RowFilter extends CompareFilter {
|
||||||
* Constructor.
|
* Constructor.
|
||||||
* @param rowCompareOp the compare op for row matching
|
* @param rowCompareOp the compare op for row matching
|
||||||
* @param rowComparator the comparator for row matching
|
* @param rowComparator the comparator for row matching
|
||||||
|
* @deprecated Since 2.0.0. Will remove in 3.0.0. Use
|
||||||
|
* {@link #RowFilter(CompareOperator, ByteArrayComparable)}} instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public RowFilter(final CompareOp rowCompareOp,
|
public RowFilter(final CompareOp rowCompareOp,
|
||||||
final ByteArrayComparable rowComparator) {
|
final ByteArrayComparable rowComparator) {
|
||||||
super(rowCompareOp, rowComparator);
|
super(rowCompareOp, rowComparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
* @param op the compare op for row matching
|
||||||
|
* @param rowComparator the comparator for row matching
|
||||||
|
*/
|
||||||
|
public RowFilter(final CompareOperator op,
|
||||||
|
final ByteArrayComparable rowComparator) {
|
||||||
|
super(op, rowComparator);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
this.filterOutRow = false;
|
this.filterOutRow = false;
|
||||||
|
@ -72,7 +86,7 @@ public class RowFilter extends CompareFilter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean filterRowKey(Cell firstRowCell) {
|
public boolean filterRowKey(Cell firstRowCell) {
|
||||||
if (compareRow(this.compareOp, this.comparator, firstRowCell)) {
|
if (compareRow(getCompareOperator(), this.comparator, firstRowCell)) {
|
||||||
this.filterOutRow = true;
|
this.filterOutRow = true;
|
||||||
}
|
}
|
||||||
return this.filterOutRow;
|
return this.filterOutRow;
|
||||||
|
@ -86,7 +100,7 @@ public class RowFilter extends CompareFilter {
|
||||||
public static Filter createFilterFromArguments(ArrayList<byte []> filterArguments) {
|
public static Filter createFilterFromArguments(ArrayList<byte []> filterArguments) {
|
||||||
@SuppressWarnings("rawtypes") // for arguments
|
@SuppressWarnings("rawtypes") // for arguments
|
||||||
ArrayList arguments = CompareFilter.extractArguments(filterArguments);
|
ArrayList arguments = CompareFilter.extractArguments(filterArguments);
|
||||||
CompareOp compareOp = (CompareOp)arguments.get(0);
|
CompareOperator compareOp = (CompareOperator)arguments.get(0);
|
||||||
ByteArrayComparable comparator = (ByteArrayComparable)arguments.get(1);
|
ByteArrayComparable comparator = (ByteArrayComparable)arguments.get(1);
|
||||||
return new RowFilter(compareOp, comparator);
|
return new RowFilter(compareOp, comparator);
|
||||||
}
|
}
|
||||||
|
@ -115,8 +129,8 @@ public class RowFilter extends CompareFilter {
|
||||||
} catch (InvalidProtocolBufferException e) {
|
} catch (InvalidProtocolBufferException e) {
|
||||||
throw new DeserializationException(e);
|
throw new DeserializationException(e);
|
||||||
}
|
}
|
||||||
final CompareOp valueCompareOp =
|
final CompareOperator valueCompareOp =
|
||||||
CompareOp.valueOf(proto.getCompareFilter().getCompareOp().name());
|
CompareOperator.valueOf(proto.getCompareFilter().getCompareOp().name());
|
||||||
ByteArrayComparable valueComparator = null;
|
ByteArrayComparable valueComparator = null;
|
||||||
try {
|
try {
|
||||||
if (proto.getCompareFilter().hasComparator()) {
|
if (proto.getCompareFilter().hasComparator()) {
|
||||||
|
@ -129,7 +143,6 @@ public class RowFilter extends CompareFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param other
|
|
||||||
* @return true if and only if the fields of the filter that are serialized
|
* @return true if and only if the fields of the filter that are serialized
|
||||||
* are equal to the corresponding fields in other. Used for testing.
|
* are equal to the corresponding fields in other. Used for testing.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.apache.hadoop.hbase.Cell;
|
import org.apache.hadoop.hbase.Cell;
|
||||||
import org.apache.hadoop.hbase.CellUtil;
|
import org.apache.hadoop.hbase.CellUtil;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.exceptions.DeserializationException;
|
import org.apache.hadoop.hbase.exceptions.DeserializationException;
|
||||||
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
|
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
|
||||||
|
@ -52,12 +53,30 @@ public class SingleColumnValueExcludeFilter extends SingleColumnValueFilter {
|
||||||
* @param qualifier name of column qualifier
|
* @param qualifier name of column qualifier
|
||||||
* @param compareOp operator
|
* @param compareOp operator
|
||||||
* @param value value to compare column values against
|
* @param value value to compare column values against
|
||||||
|
* {@link #SingleColumnValueExcludeFilter(byte[], byte[], CompareOperator, byte[])}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public SingleColumnValueExcludeFilter(byte[] family, byte[] qualifier,
|
public SingleColumnValueExcludeFilter(byte[] family, byte[] qualifier,
|
||||||
CompareOp compareOp, byte[] value) {
|
CompareOp compareOp, byte[] value) {
|
||||||
super(family, qualifier, compareOp, value);
|
super(family, qualifier, compareOp, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for binary compare of the value of a single column. If the
|
||||||
|
* column is found and the condition passes, all columns of the row will be
|
||||||
|
* emitted; except for the tested column value. If the column is not found or
|
||||||
|
* the condition fails, the row will not be emitted.
|
||||||
|
*
|
||||||
|
* @param family name of column family
|
||||||
|
* @param qualifier name of column qualifier
|
||||||
|
* @param op operator
|
||||||
|
* @param value value to compare column values against
|
||||||
|
*/
|
||||||
|
public SingleColumnValueExcludeFilter(byte[] family, byte[] qualifier,
|
||||||
|
CompareOperator op, byte[] value) {
|
||||||
|
super(family, qualifier, op, value);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for binary compare of the value of a single column. If the
|
* Constructor for binary compare of the value of a single column. If the
|
||||||
* column is found and the condition passes, all columns of the row will be
|
* column is found and the condition passes, all columns of the row will be
|
||||||
|
@ -72,12 +91,36 @@ public class SingleColumnValueExcludeFilter extends SingleColumnValueFilter {
|
||||||
* @param qualifier name of column qualifier
|
* @param qualifier name of column qualifier
|
||||||
* @param compareOp operator
|
* @param compareOp operator
|
||||||
* @param comparator Comparator to use.
|
* @param comparator Comparator to use.
|
||||||
|
* @deprecated Since 2.0.0. Will be removed in 3.0.0. Use
|
||||||
|
* {@link #SingleColumnValueExcludeFilter(byte[], byte[], CompareOperator, ByteArrayComparable)}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public SingleColumnValueExcludeFilter(byte[] family, byte[] qualifier,
|
public SingleColumnValueExcludeFilter(byte[] family, byte[] qualifier,
|
||||||
CompareOp compareOp, ByteArrayComparable comparator) {
|
CompareOp compareOp, ByteArrayComparable comparator) {
|
||||||
super(family, qualifier, compareOp, comparator);
|
super(family, qualifier, compareOp, comparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for binary compare of the value of a single column. If the
|
||||||
|
* column is found and the condition passes, all columns of the row will be
|
||||||
|
* emitted; except for the tested column value. If the condition fails, the
|
||||||
|
* row will not be emitted.
|
||||||
|
* <p>
|
||||||
|
* Use the filterIfColumnMissing flag to set whether the rest of the columns
|
||||||
|
* in a row will be emitted if the specified column to check is not found in
|
||||||
|
* the row.
|
||||||
|
*
|
||||||
|
* @param family name of column family
|
||||||
|
* @param qualifier name of column qualifier
|
||||||
|
* @param op operator
|
||||||
|
* @param comparator Comparator to use.
|
||||||
|
*/
|
||||||
|
public SingleColumnValueExcludeFilter(byte[] family, byte[] qualifier,
|
||||||
|
CompareOperator op, ByteArrayComparable comparator) {
|
||||||
|
super(family, qualifier, op, comparator);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for protobuf deserialization only.
|
* Constructor for protobuf deserialization only.
|
||||||
* @param family
|
* @param family
|
||||||
|
@ -86,11 +129,30 @@ public class SingleColumnValueExcludeFilter extends SingleColumnValueFilter {
|
||||||
* @param comparator
|
* @param comparator
|
||||||
* @param filterIfMissing
|
* @param filterIfMissing
|
||||||
* @param latestVersionOnly
|
* @param latestVersionOnly
|
||||||
|
* @deprecated Since 2.0.0. Will be removed in 3.0.0. Use
|
||||||
|
* {@link #SingleColumnValueExcludeFilter(byte[], byte[], CompareOperator, ByteArrayComparable, boolean, boolean)}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
protected SingleColumnValueExcludeFilter(final byte[] family, final byte[] qualifier,
|
protected SingleColumnValueExcludeFilter(final byte[] family, final byte[] qualifier,
|
||||||
final CompareOp compareOp, ByteArrayComparable comparator, final boolean filterIfMissing,
|
final CompareOp compareOp, ByteArrayComparable comparator, final boolean filterIfMissing,
|
||||||
final boolean latestVersionOnly) {
|
final boolean latestVersionOnly) {
|
||||||
super(family, qualifier, compareOp, comparator, filterIfMissing, latestVersionOnly);
|
this(family, qualifier, CompareOperator.valueOf(compareOp.name()), comparator,
|
||||||
|
filterIfMissing, latestVersionOnly);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for protobuf deserialization only.
|
||||||
|
* @param family
|
||||||
|
* @param qualifier
|
||||||
|
* @param op
|
||||||
|
* @param comparator
|
||||||
|
* @param filterIfMissing
|
||||||
|
* @param latestVersionOnly
|
||||||
|
*/
|
||||||
|
protected SingleColumnValueExcludeFilter(final byte[] family, final byte[] qualifier,
|
||||||
|
final CompareOperator op, ByteArrayComparable comparator, final boolean filterIfMissing,
|
||||||
|
final boolean latestVersionOnly) {
|
||||||
|
super(family, qualifier, op, comparator, filterIfMissing, latestVersionOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We cleaned result row in FilterRow to be consistent with scanning process.
|
// We cleaned result row in FilterRow to be consistent with scanning process.
|
||||||
|
@ -151,8 +213,8 @@ public class SingleColumnValueExcludeFilter extends SingleColumnValueFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
FilterProtos.SingleColumnValueFilter parentProto = proto.getSingleColumnValueFilter();
|
FilterProtos.SingleColumnValueFilter parentProto = proto.getSingleColumnValueFilter();
|
||||||
final CompareOp compareOp =
|
final CompareOperator compareOp =
|
||||||
CompareOp.valueOf(parentProto.getCompareOp().name());
|
CompareOperator.valueOf(parentProto.getCompareOp().name());
|
||||||
final ByteArrayComparable comparator;
|
final ByteArrayComparable comparator;
|
||||||
try {
|
try {
|
||||||
comparator = ProtobufUtil.toComparator(parentProto.getComparator());
|
comparator = ProtobufUtil.toComparator(parentProto.getComparator());
|
||||||
|
@ -167,7 +229,6 @@ public class SingleColumnValueExcludeFilter extends SingleColumnValueFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param other
|
|
||||||
* @return true if and only if the fields of the filter that are serialized
|
* @return true if and only if the fields of the filter that are serialized
|
||||||
* are equal to the corresponding fields in other. Used for testing.
|
* are equal to the corresponding fields in other. Used for testing.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.util.ArrayList;
|
||||||
import org.apache.hadoop.hbase.Cell;
|
import org.apache.hadoop.hbase.Cell;
|
||||||
import org.apache.hadoop.hbase.CellComparator;
|
import org.apache.hadoop.hbase.CellComparator;
|
||||||
import org.apache.hadoop.hbase.CellUtil;
|
import org.apache.hadoop.hbase.CellUtil;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.exceptions.DeserializationException;
|
import org.apache.hadoop.hbase.exceptions.DeserializationException;
|
||||||
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
|
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
|
||||||
|
@ -71,7 +72,7 @@ public class SingleColumnValueFilter extends FilterBase {
|
||||||
|
|
||||||
protected byte [] columnFamily;
|
protected byte [] columnFamily;
|
||||||
protected byte [] columnQualifier;
|
protected byte [] columnQualifier;
|
||||||
protected CompareOp compareOp;
|
protected CompareOperator op;
|
||||||
protected org.apache.hadoop.hbase.filter.ByteArrayComparable comparator;
|
protected org.apache.hadoop.hbase.filter.ByteArrayComparable comparator;
|
||||||
protected boolean foundColumn = false;
|
protected boolean foundColumn = false;
|
||||||
protected boolean matchedColumn = false;
|
protected boolean matchedColumn = false;
|
||||||
|
@ -91,10 +92,34 @@ public class SingleColumnValueFilter extends FilterBase {
|
||||||
* @param qualifier name of column qualifier
|
* @param qualifier name of column qualifier
|
||||||
* @param compareOp operator
|
* @param compareOp operator
|
||||||
* @param value value to compare column values against
|
* @param value value to compare column values against
|
||||||
|
* @deprecated Since 2.0.0. Will be removed in 3.0.0. Use
|
||||||
|
* {@link #SingleColumnValueFilter(byte[], byte[], CompareOperator, byte[])} instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public SingleColumnValueFilter(final byte [] family, final byte [] qualifier,
|
public SingleColumnValueFilter(final byte [] family, final byte [] qualifier,
|
||||||
final CompareOp compareOp, final byte[] value) {
|
final CompareOp compareOp, final byte[] value) {
|
||||||
this(family, qualifier, compareOp, new org.apache.hadoop.hbase.filter.BinaryComparator(value));
|
this(family, qualifier, CompareOperator.valueOf(compareOp.name()),
|
||||||
|
new org.apache.hadoop.hbase.filter.BinaryComparator(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for binary compare of the value of a single column. If the
|
||||||
|
* column is found and the condition passes, all columns of the row will be
|
||||||
|
* emitted. If the condition fails, the row will not be emitted.
|
||||||
|
* <p>
|
||||||
|
* Use the filterIfColumnMissing flag to set whether the rest of the columns
|
||||||
|
* in a row will be emitted if the specified column to check is not found in
|
||||||
|
* the row.
|
||||||
|
*
|
||||||
|
* @param family name of column family
|
||||||
|
* @param qualifier name of column qualifier
|
||||||
|
* @param op operator
|
||||||
|
* @param value value to compare column values against
|
||||||
|
*/
|
||||||
|
public SingleColumnValueFilter(final byte [] family, final byte [] qualifier,
|
||||||
|
final CompareOperator op, final byte[] value) {
|
||||||
|
this(family, qualifier, op,
|
||||||
|
new org.apache.hadoop.hbase.filter.BinaryComparator(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,13 +135,36 @@ public class SingleColumnValueFilter extends FilterBase {
|
||||||
* @param qualifier name of column qualifier
|
* @param qualifier name of column qualifier
|
||||||
* @param compareOp operator
|
* @param compareOp operator
|
||||||
* @param comparator Comparator to use.
|
* @param comparator Comparator to use.
|
||||||
|
* @deprecated Since 2.0.0. Will be removed in 3.0.0. Use
|
||||||
|
* {@link #SingleColumnValueFilter(byte[], byte[], CompareOperator, ByteArrayComparable)} instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public SingleColumnValueFilter(final byte [] family, final byte [] qualifier,
|
public SingleColumnValueFilter(final byte [] family, final byte [] qualifier,
|
||||||
final CompareOp compareOp,
|
final CompareOp compareOp,
|
||||||
final org.apache.hadoop.hbase.filter.ByteArrayComparable comparator) {
|
final org.apache.hadoop.hbase.filter.ByteArrayComparable comparator) {
|
||||||
|
this(family, qualifier, CompareOperator.valueOf(compareOp.name()), comparator);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for binary compare of the value of a single column. If the
|
||||||
|
* column is found and the condition passes, all columns of the row will be
|
||||||
|
* emitted. If the condition fails, the row will not be emitted.
|
||||||
|
* <p>
|
||||||
|
* Use the filterIfColumnMissing flag to set whether the rest of the columns
|
||||||
|
* in a row will be emitted if the specified column to check is not found in
|
||||||
|
* the row.
|
||||||
|
*
|
||||||
|
* @param family name of column family
|
||||||
|
* @param qualifier name of column qualifier
|
||||||
|
* @param op operator
|
||||||
|
* @param comparator Comparator to use.
|
||||||
|
*/
|
||||||
|
public SingleColumnValueFilter(final byte [] family, final byte [] qualifier,
|
||||||
|
final CompareOperator op,
|
||||||
|
final org.apache.hadoop.hbase.filter.ByteArrayComparable comparator) {
|
||||||
this.columnFamily = family;
|
this.columnFamily = family;
|
||||||
this.columnQualifier = qualifier;
|
this.columnQualifier = qualifier;
|
||||||
this.compareOp = compareOp;
|
this.op = op;
|
||||||
this.comparator = comparator;
|
this.comparator = comparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,21 +176,47 @@ public class SingleColumnValueFilter extends FilterBase {
|
||||||
* @param comparator
|
* @param comparator
|
||||||
* @param filterIfMissing
|
* @param filterIfMissing
|
||||||
* @param latestVersionOnly
|
* @param latestVersionOnly
|
||||||
|
* @deprecated Since 2.0.0. Will be removed in 3.0.0. Use
|
||||||
|
* {@link #SingleColumnValueFilter(byte[], byte[], CompareOperator, ByteArrayComparable,
|
||||||
|
* boolean, boolean)} instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
protected SingleColumnValueFilter(final byte[] family, final byte[] qualifier,
|
protected SingleColumnValueFilter(final byte[] family, final byte[] qualifier,
|
||||||
final CompareOp compareOp, org.apache.hadoop.hbase.filter.ByteArrayComparable comparator,
|
final CompareOp compareOp, org.apache.hadoop.hbase.filter.ByteArrayComparable comparator,
|
||||||
final boolean filterIfMissing,
|
final boolean filterIfMissing,
|
||||||
final boolean latestVersionOnly) {
|
final boolean latestVersionOnly) {
|
||||||
this(family, qualifier, compareOp, comparator);
|
this(family, qualifier, CompareOperator.valueOf(compareOp.name()), comparator, filterIfMissing,
|
||||||
|
latestVersionOnly);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for protobuf deserialization only.
|
||||||
|
* @param family
|
||||||
|
* @param qualifier
|
||||||
|
* @param op
|
||||||
|
* @param comparator
|
||||||
|
* @param filterIfMissing
|
||||||
|
* @param latestVersionOnly
|
||||||
|
*/
|
||||||
|
protected SingleColumnValueFilter(final byte[] family, final byte[] qualifier,
|
||||||
|
final CompareOperator op, org.apache.hadoop.hbase.filter.ByteArrayComparable comparator,
|
||||||
|
final boolean filterIfMissing, final boolean latestVersionOnly) {
|
||||||
|
this(family, qualifier, op, comparator);
|
||||||
this.filterIfMissing = filterIfMissing;
|
this.filterIfMissing = filterIfMissing;
|
||||||
this.latestVersionOnly = latestVersionOnly;
|
this.latestVersionOnly = latestVersionOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return operator
|
* @return operator
|
||||||
|
* @deprecated since 2.0.0. Will be removed in 3.0.0. Use {@link #getCompareOperator()} instead.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public CompareOp getOperator() {
|
public CompareOp getOperator() {
|
||||||
return compareOp;
|
return CompareOp.valueOf(op.name());
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompareOperator getCompareOperator() {
|
||||||
|
return op;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -195,22 +269,7 @@ public class SingleColumnValueFilter extends FilterBase {
|
||||||
|
|
||||||
private boolean filterColumnValue(final Cell cell) {
|
private boolean filterColumnValue(final Cell cell) {
|
||||||
int compareResult = CellComparator.compareValue(cell, this.comparator);
|
int compareResult = CellComparator.compareValue(cell, this.comparator);
|
||||||
switch (this.compareOp) {
|
return CompareFilter.compare(this.op, compareResult);
|
||||||
case LESS:
|
|
||||||
return compareResult <= 0;
|
|
||||||
case LESS_OR_EQUAL:
|
|
||||||
return compareResult < 0;
|
|
||||||
case EQUAL:
|
|
||||||
return compareResult != 0;
|
|
||||||
case NOT_EQUAL:
|
|
||||||
return compareResult == 0;
|
|
||||||
case GREATER_OR_EQUAL:
|
|
||||||
return compareResult > 0;
|
|
||||||
case GREATER:
|
|
||||||
return compareResult >= 0;
|
|
||||||
default:
|
|
||||||
throw new RuntimeException("Unknown Compare op " + compareOp.name());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean filterRow() {
|
public boolean filterRow() {
|
||||||
|
@ -276,21 +335,21 @@ public class SingleColumnValueFilter extends FilterBase {
|
||||||
"Expected 4 or 6 but got: %s", filterArguments.size());
|
"Expected 4 or 6 but got: %s", filterArguments.size());
|
||||||
byte [] family = ParseFilter.removeQuotesFromByteArray(filterArguments.get(0));
|
byte [] family = ParseFilter.removeQuotesFromByteArray(filterArguments.get(0));
|
||||||
byte [] qualifier = ParseFilter.removeQuotesFromByteArray(filterArguments.get(1));
|
byte [] qualifier = ParseFilter.removeQuotesFromByteArray(filterArguments.get(1));
|
||||||
CompareOp compareOp = ParseFilter.createCompareOp(filterArguments.get(2));
|
CompareOperator op = ParseFilter.createCompareOperator(filterArguments.get(2));
|
||||||
org.apache.hadoop.hbase.filter.ByteArrayComparable comparator = ParseFilter.createComparator(
|
org.apache.hadoop.hbase.filter.ByteArrayComparable comparator = ParseFilter.createComparator(
|
||||||
ParseFilter.removeQuotesFromByteArray(filterArguments.get(3)));
|
ParseFilter.removeQuotesFromByteArray(filterArguments.get(3)));
|
||||||
|
|
||||||
if (comparator instanceof RegexStringComparator ||
|
if (comparator instanceof RegexStringComparator ||
|
||||||
comparator instanceof SubstringComparator) {
|
comparator instanceof SubstringComparator) {
|
||||||
if (compareOp != CompareOp.EQUAL &&
|
if (op != CompareOperator.EQUAL &&
|
||||||
compareOp != CompareOp.NOT_EQUAL) {
|
op != CompareOperator.NOT_EQUAL) {
|
||||||
throw new IllegalArgumentException ("A regexstring comparator and substring comparator " +
|
throw new IllegalArgumentException ("A regexstring comparator and substring comparator " +
|
||||||
"can only be used with EQUAL and NOT_EQUAL");
|
"can only be used with EQUAL and NOT_EQUAL");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SingleColumnValueFilter filter = new SingleColumnValueFilter(family, qualifier,
|
SingleColumnValueFilter filter = new SingleColumnValueFilter(family, qualifier,
|
||||||
compareOp, comparator);
|
op, comparator);
|
||||||
|
|
||||||
if (filterArguments.size() == 6) {
|
if (filterArguments.size() == 6) {
|
||||||
boolean filterIfMissing = ParseFilter.convertByteArrayToBoolean(filterArguments.get(4));
|
boolean filterIfMissing = ParseFilter.convertByteArrayToBoolean(filterArguments.get(4));
|
||||||
|
@ -310,7 +369,7 @@ public class SingleColumnValueFilter extends FilterBase {
|
||||||
if (this.columnQualifier != null) {
|
if (this.columnQualifier != null) {
|
||||||
builder.setColumnQualifier(UnsafeByteOperations.unsafeWrap(this.columnQualifier));
|
builder.setColumnQualifier(UnsafeByteOperations.unsafeWrap(this.columnQualifier));
|
||||||
}
|
}
|
||||||
HBaseProtos.CompareType compareOp = CompareType.valueOf(this.compareOp.name());
|
HBaseProtos.CompareType compareOp = CompareType.valueOf(this.op.name());
|
||||||
builder.setCompareOp(compareOp);
|
builder.setCompareOp(compareOp);
|
||||||
builder.setComparator(ProtobufUtil.toComparator(this.comparator));
|
builder.setComparator(ProtobufUtil.toComparator(this.comparator));
|
||||||
builder.setFilterIfMissing(this.filterIfMissing);
|
builder.setFilterIfMissing(this.filterIfMissing);
|
||||||
|
@ -341,8 +400,8 @@ public class SingleColumnValueFilter extends FilterBase {
|
||||||
throw new DeserializationException(e);
|
throw new DeserializationException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
final CompareOp compareOp =
|
final CompareOperator compareOp =
|
||||||
CompareOp.valueOf(proto.getCompareOp().name());
|
CompareOperator.valueOf(proto.getCompareOp().name());
|
||||||
final org.apache.hadoop.hbase.filter.ByteArrayComparable comparator;
|
final org.apache.hadoop.hbase.filter.ByteArrayComparable comparator;
|
||||||
try {
|
try {
|
||||||
comparator = ProtobufUtil.toComparator(proto.getComparator());
|
comparator = ProtobufUtil.toComparator(proto.getComparator());
|
||||||
|
@ -357,7 +416,6 @@ public class SingleColumnValueFilter extends FilterBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param other
|
|
||||||
* @return true if and only if the fields of the filter that are serialized
|
* @return true if and only if the fields of the filter that are serialized
|
||||||
* are equal to the corresponding fields in other. Used for testing.
|
* are equal to the corresponding fields in other. Used for testing.
|
||||||
*/
|
*/
|
||||||
|
@ -368,7 +426,7 @@ public class SingleColumnValueFilter extends FilterBase {
|
||||||
SingleColumnValueFilter other = (SingleColumnValueFilter)o;
|
SingleColumnValueFilter other = (SingleColumnValueFilter)o;
|
||||||
return Bytes.equals(this.getFamily(), other.getFamily())
|
return Bytes.equals(this.getFamily(), other.getFamily())
|
||||||
&& Bytes.equals(this.getQualifier(), other.getQualifier())
|
&& Bytes.equals(this.getQualifier(), other.getQualifier())
|
||||||
&& this.compareOp.equals(other.compareOp)
|
&& this.op.equals(other.op)
|
||||||
&& this.getComparator().areSerializedFieldsEqual(other.getComparator())
|
&& this.getComparator().areSerializedFieldsEqual(other.getComparator())
|
||||||
&& this.getFilterIfMissing() == other.getFilterIfMissing()
|
&& this.getFilterIfMissing() == other.getFilterIfMissing()
|
||||||
&& this.getLatestVersionOnly() == other.getLatestVersionOnly();
|
&& this.getLatestVersionOnly() == other.getLatestVersionOnly();
|
||||||
|
@ -387,7 +445,7 @@ public class SingleColumnValueFilter extends FilterBase {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("%s (%s, %s, %s, %s)",
|
return String.format("%s (%s, %s, %s, %s)",
|
||||||
this.getClass().getSimpleName(), Bytes.toStringBinary(this.columnFamily),
|
this.getClass().getSimpleName(), Bytes.toStringBinary(this.columnFamily),
|
||||||
Bytes.toStringBinary(this.columnQualifier), this.compareOp.name(),
|
Bytes.toStringBinary(this.columnQualifier), this.op.name(),
|
||||||
Bytes.toStringBinary(this.comparator.getValue()));
|
Bytes.toStringBinary(this.comparator.getValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.apache.hadoop.hbase.Cell;
|
import org.apache.hadoop.hbase.Cell;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.exceptions.DeserializationException;
|
import org.apache.hadoop.hbase.exceptions.DeserializationException;
|
||||||
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
|
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
|
||||||
|
@ -49,15 +50,27 @@ public class ValueFilter extends CompareFilter {
|
||||||
* Constructor.
|
* Constructor.
|
||||||
* @param valueCompareOp the compare op for value matching
|
* @param valueCompareOp the compare op for value matching
|
||||||
* @param valueComparator the comparator for value matching
|
* @param valueComparator the comparator for value matching
|
||||||
|
* @deprecated Since 2.0.0. Will be removed in 3.0.0.
|
||||||
|
* Use {@link #ValueFilter(CompareOperator, ByteArrayComparable)}
|
||||||
*/
|
*/
|
||||||
public ValueFilter(final CompareOp valueCompareOp,
|
public ValueFilter(final CompareOp valueCompareOp,
|
||||||
final ByteArrayComparable valueComparator) {
|
final ByteArrayComparable valueComparator) {
|
||||||
super(valueCompareOp, valueComparator);
|
super(valueCompareOp, valueComparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
* @param valueCompareOp the compare op for value matching
|
||||||
|
* @param valueComparator the comparator for value matching
|
||||||
|
*/
|
||||||
|
public ValueFilter(final CompareOperator valueCompareOp,
|
||||||
|
final ByteArrayComparable valueComparator) {
|
||||||
|
super(valueCompareOp, valueComparator);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReturnCode filterKeyValue(Cell v) {
|
public ReturnCode filterKeyValue(Cell v) {
|
||||||
if (compareValue(this.compareOp, this.comparator, v)) {
|
if (compareValue(getCompareOperator(), this.comparator, v)) {
|
||||||
return ReturnCode.SKIP;
|
return ReturnCode.SKIP;
|
||||||
}
|
}
|
||||||
return ReturnCode.INCLUDE;
|
return ReturnCode.INCLUDE;
|
||||||
|
@ -66,7 +79,7 @@ public class ValueFilter extends CompareFilter {
|
||||||
public static Filter createFilterFromArguments(ArrayList<byte []> filterArguments) {
|
public static Filter createFilterFromArguments(ArrayList<byte []> filterArguments) {
|
||||||
@SuppressWarnings("rawtypes") // for arguments
|
@SuppressWarnings("rawtypes") // for arguments
|
||||||
ArrayList arguments = CompareFilter.extractArguments(filterArguments);
|
ArrayList arguments = CompareFilter.extractArguments(filterArguments);
|
||||||
CompareOp compareOp = (CompareOp)arguments.get(0);
|
CompareOperator compareOp = (CompareOperator)arguments.get(0);
|
||||||
ByteArrayComparable comparator = (ByteArrayComparable)arguments.get(1);
|
ByteArrayComparable comparator = (ByteArrayComparable)arguments.get(1);
|
||||||
return new ValueFilter(compareOp, comparator);
|
return new ValueFilter(compareOp, comparator);
|
||||||
}
|
}
|
||||||
|
@ -95,8 +108,8 @@ public class ValueFilter extends CompareFilter {
|
||||||
} catch (InvalidProtocolBufferException e) {
|
} catch (InvalidProtocolBufferException e) {
|
||||||
throw new DeserializationException(e);
|
throw new DeserializationException(e);
|
||||||
}
|
}
|
||||||
final CompareOp valueCompareOp =
|
final CompareOperator valueCompareOp =
|
||||||
CompareOp.valueOf(proto.getCompareFilter().getCompareOp().name());
|
CompareOperator.valueOf(proto.getCompareFilter().getCompareOp().name());
|
||||||
ByteArrayComparable valueComparator = null;
|
ByteArrayComparable valueComparator = null;
|
||||||
try {
|
try {
|
||||||
if (proto.getCompareFilter().hasComparator()) {
|
if (proto.getCompareFilter().hasComparator()) {
|
||||||
|
@ -109,7 +122,7 @@ public class ValueFilter extends CompareFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param other
|
|
||||||
* @return true if and only if the fields of the filter that are serialized
|
* @return true if and only if the fields of the filter that are serialized
|
||||||
* are equal to the corresponding fields in other. Used for testing.
|
* are equal to the corresponding fields in other. Used for testing.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.hbase.Cell;
|
import org.apache.hadoop.hbase.Cell;
|
||||||
import org.apache.hadoop.hbase.CellScanner;
|
import org.apache.hadoop.hbase.CellScanner;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.NamespaceDescriptor;
|
import org.apache.hadoop.hbase.NamespaceDescriptor;
|
||||||
import org.apache.hadoop.hbase.ServerName;
|
import org.apache.hadoop.hbase.ServerName;
|
||||||
import org.apache.hadoop.hbase.TableName;
|
import org.apache.hadoop.hbase.TableName;
|
||||||
|
@ -196,9 +197,9 @@ public class QuotaTableUtil {
|
||||||
|
|
||||||
if (!Strings.isEmpty(filter.getNamespaceFilter())) {
|
if (!Strings.isEmpty(filter.getNamespaceFilter())) {
|
||||||
FilterList nsFilters = new FilterList(FilterList.Operator.MUST_PASS_ALL);
|
FilterList nsFilters = new FilterList(FilterList.Operator.MUST_PASS_ALL);
|
||||||
nsFilters.addFilter(new RowFilter(CompareFilter.CompareOp.EQUAL,
|
nsFilters.addFilter(new RowFilter(CompareOperator.EQUAL,
|
||||||
new RegexStringComparator(getUserRowKeyRegex(filter.getUserFilter()), 0)));
|
new RegexStringComparator(getUserRowKeyRegex(filter.getUserFilter()), 0)));
|
||||||
nsFilters.addFilter(new QualifierFilter(CompareFilter.CompareOp.EQUAL,
|
nsFilters.addFilter(new QualifierFilter(CompareOperator.EQUAL,
|
||||||
new RegexStringComparator(
|
new RegexStringComparator(
|
||||||
getSettingsQualifierRegexForUserNamespace(filter.getNamespaceFilter()), 0)));
|
getSettingsQualifierRegexForUserNamespace(filter.getNamespaceFilter()), 0)));
|
||||||
userFilters.addFilter(nsFilters);
|
userFilters.addFilter(nsFilters);
|
||||||
|
@ -206,25 +207,25 @@ public class QuotaTableUtil {
|
||||||
}
|
}
|
||||||
if (!Strings.isEmpty(filter.getTableFilter())) {
|
if (!Strings.isEmpty(filter.getTableFilter())) {
|
||||||
FilterList tableFilters = new FilterList(FilterList.Operator.MUST_PASS_ALL);
|
FilterList tableFilters = new FilterList(FilterList.Operator.MUST_PASS_ALL);
|
||||||
tableFilters.addFilter(new RowFilter(CompareFilter.CompareOp.EQUAL,
|
tableFilters.addFilter(new RowFilter(CompareOperator.EQUAL,
|
||||||
new RegexStringComparator(getUserRowKeyRegex(filter.getUserFilter()), 0)));
|
new RegexStringComparator(getUserRowKeyRegex(filter.getUserFilter()), 0)));
|
||||||
tableFilters.addFilter(new QualifierFilter(CompareFilter.CompareOp.EQUAL,
|
tableFilters.addFilter(new QualifierFilter(CompareOperator.EQUAL,
|
||||||
new RegexStringComparator(
|
new RegexStringComparator(
|
||||||
getSettingsQualifierRegexForUserTable(filter.getTableFilter()), 0)));
|
getSettingsQualifierRegexForUserTable(filter.getTableFilter()), 0)));
|
||||||
userFilters.addFilter(tableFilters);
|
userFilters.addFilter(tableFilters);
|
||||||
hasFilter = true;
|
hasFilter = true;
|
||||||
}
|
}
|
||||||
if (!hasFilter) {
|
if (!hasFilter) {
|
||||||
userFilters.addFilter(new RowFilter(CompareFilter.CompareOp.EQUAL,
|
userFilters.addFilter(new RowFilter(CompareOperator.EQUAL,
|
||||||
new RegexStringComparator(getUserRowKeyRegex(filter.getUserFilter()), 0)));
|
new RegexStringComparator(getUserRowKeyRegex(filter.getUserFilter()), 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
filterList.addFilter(userFilters);
|
filterList.addFilter(userFilters);
|
||||||
} else if (!Strings.isEmpty(filter.getTableFilter())) {
|
} else if (!Strings.isEmpty(filter.getTableFilter())) {
|
||||||
filterList.addFilter(new RowFilter(CompareFilter.CompareOp.EQUAL,
|
filterList.addFilter(new RowFilter(CompareOperator.EQUAL,
|
||||||
new RegexStringComparator(getTableRowKeyRegex(filter.getTableFilter()), 0)));
|
new RegexStringComparator(getTableRowKeyRegex(filter.getTableFilter()), 0)));
|
||||||
} else if (!Strings.isEmpty(filter.getNamespaceFilter())) {
|
} else if (!Strings.isEmpty(filter.getNamespaceFilter())) {
|
||||||
filterList.addFilter(new RowFilter(CompareFilter.CompareOp.EQUAL,
|
filterList.addFilter(new RowFilter(CompareOperator.EQUAL,
|
||||||
new RegexStringComparator(getNamespaceRowKeyRegex(filter.getNamespaceFilter()), 0)));
|
new RegexStringComparator(getNamespaceRowKeyRegex(filter.getNamespaceFilter()), 0)));
|
||||||
}
|
}
|
||||||
return filterList;
|
return filterList;
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.apache.hadoop.hbase.util.Bytes;
|
||||||
|
|
||||||
/** Base class for byte array comparators */
|
/** Base class for byte array comparators */
|
||||||
@InterfaceAudience.Public
|
@InterfaceAudience.Public
|
||||||
// TODO Now we are deviating a lot from the actual Comparable<byte[]> what this implements, by
|
// TODO Now we are deviating a lot from the actual Comparable<byte[]> that this implements, by
|
||||||
// adding special compareTo methods. We have to clean it. Deprecate this class and replace it
|
// adding special compareTo methods. We have to clean it. Deprecate this class and replace it
|
||||||
// with a more generic one which says it compares bytes (not necessary a byte array only)
|
// with a more generic one which says it compares bytes (not necessary a byte array only)
|
||||||
// BytesComparable implements Comparable<Byte> will work?
|
// BytesComparable implements Comparable<Byte> will work?
|
||||||
|
|
|
@ -165,7 +165,7 @@ public class IntegrationTestLazyCfLoading {
|
||||||
|
|
||||||
public Filter getScanFilter() {
|
public Filter getScanFilter() {
|
||||||
SingleColumnValueFilter scf = new SingleColumnValueFilter(ESSENTIAL_CF, FILTER_COLUMN,
|
SingleColumnValueFilter scf = new SingleColumnValueFilter(ESSENTIAL_CF, FILTER_COLUMN,
|
||||||
CompareFilter.CompareOp.EQUAL, Bytes.toBytes(ACCEPTED_VALUE));
|
CompareOperator.EQUAL, Bytes.toBytes(ACCEPTED_VALUE));
|
||||||
scf.setFilterIfMissing(true);
|
scf.setFilterIfMissing(true);
|
||||||
return scf;
|
return scf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.HConstants;
|
import org.apache.hadoop.hbase.HConstants;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
|
@ -124,8 +125,6 @@ public class CellCounter extends Configured implements Tool {
|
||||||
* @param values The columns.
|
* @param values The columns.
|
||||||
* @param context The current context.
|
* @param context The current context.
|
||||||
* @throws IOException When something is broken with the data.
|
* @throws IOException When something is broken with the data.
|
||||||
* @see org.apache.hadoop.mapreduce.Mapper#map(KEYIN, VALUEIN,
|
|
||||||
* org.apache.hadoop.mapreduce.Mapper.Context)
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -260,7 +259,7 @@ public class CellCounter extends Configured implements Tool {
|
||||||
if (filterCriteria == null) return null;
|
if (filterCriteria == null) return null;
|
||||||
if (filterCriteria.startsWith("^")) {
|
if (filterCriteria.startsWith("^")) {
|
||||||
String regexPattern = filterCriteria.substring(1, filterCriteria.length());
|
String regexPattern = filterCriteria.substring(1, filterCriteria.length());
|
||||||
rowFilter = new RowFilter(CompareFilter.CompareOp.EQUAL, new RegexStringComparator(regexPattern));
|
rowFilter = new RowFilter(CompareOperator.EQUAL, new RegexStringComparator(regexPattern));
|
||||||
} else {
|
} else {
|
||||||
rowFilter = new PrefixFilter(Bytes.toBytesBinary(filterCriteria));
|
rowFilter = new PrefixFilter(Bytes.toBytesBinary(filterCriteria));
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.HConstants;
|
import org.apache.hadoop.hbase.HConstants;
|
||||||
import org.apache.hadoop.hbase.TableName;
|
import org.apache.hadoop.hbase.TableName;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||||
|
@ -86,7 +87,7 @@ public final class ExportUtils {
|
||||||
if (filterCriteria == null) return null;
|
if (filterCriteria == null) return null;
|
||||||
if (filterCriteria.startsWith("^")) {
|
if (filterCriteria.startsWith("^")) {
|
||||||
String regexPattern = filterCriteria.substring(1, filterCriteria.length());
|
String regexPattern = filterCriteria.substring(1, filterCriteria.length());
|
||||||
exportFilter = new RowFilter(CompareFilter.CompareOp.EQUAL, new RegexStringComparator(regexPattern));
|
exportFilter = new RowFilter(CompareOperator.EQUAL, new RegexStringComparator(regexPattern));
|
||||||
} else {
|
} else {
|
||||||
exportFilter = new PrefixFilter(Bytes.toBytesBinary(filterCriteria));
|
exportFilter = new PrefixFilter(Bytes.toBytesBinary(filterCriteria));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1889,7 +1889,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
|
||||||
this.table.put(put);
|
this.table.put(put);
|
||||||
RowMutations mutations = new RowMutations(bytes);
|
RowMutations mutations = new RowMutations(bytes);
|
||||||
mutations.add(put);
|
mutations.add(put);
|
||||||
this.table.checkAndMutate(bytes, FAMILY_NAME, getQualifier(), CompareOp.EQUAL, bytes,
|
this.table.checkAndMutate(bytes, FAMILY_NAME, getQualifier(), CompareOperator.EQUAL, bytes,
|
||||||
mutations);
|
mutations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1906,7 +1906,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
|
||||||
Put put = new Put(bytes);
|
Put put = new Put(bytes);
|
||||||
put.addColumn(FAMILY_NAME, getQualifier(), bytes);
|
put.addColumn(FAMILY_NAME, getQualifier(), bytes);
|
||||||
this.table.put(put);
|
this.table.put(put);
|
||||||
this.table.checkAndPut(bytes, FAMILY_NAME, getQualifier(), CompareOp.EQUAL, bytes, put);
|
this.table.checkAndPut(bytes, FAMILY_NAME, getQualifier(), CompareOperator.EQUAL, bytes, put);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1924,7 +1924,8 @@ public class PerformanceEvaluation extends Configured implements Tool {
|
||||||
this.table.put(put);
|
this.table.put(put);
|
||||||
Delete delete = new Delete(put.getRow());
|
Delete delete = new Delete(put.getRow());
|
||||||
delete.addColumn(FAMILY_NAME, getQualifier());
|
delete.addColumn(FAMILY_NAME, getQualifier());
|
||||||
this.table.checkAndDelete(bytes, FAMILY_NAME, getQualifier(), CompareOp.EQUAL, bytes, delete);
|
this.table.checkAndDelete(bytes, FAMILY_NAME, getQualifier(),
|
||||||
|
CompareOperator.EQUAL, bytes, delete);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2008,7 +2009,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
|
||||||
protected Scan constructScan(byte[] valuePrefix) throws IOException {
|
protected Scan constructScan(byte[] valuePrefix) throws IOException {
|
||||||
FilterList list = new FilterList();
|
FilterList list = new FilterList();
|
||||||
Filter filter = new SingleColumnValueFilter(
|
Filter filter = new SingleColumnValueFilter(
|
||||||
FAMILY_NAME, COLUMN_ZERO, CompareFilter.CompareOp.EQUAL,
|
FAMILY_NAME, COLUMN_ZERO, CompareOperator.EQUAL,
|
||||||
new BinaryComparator(valuePrefix)
|
new BinaryComparator(valuePrefix)
|
||||||
);
|
);
|
||||||
list.addFilter(filter);
|
list.addFilter(filter);
|
||||||
|
|
|
@ -405,7 +405,8 @@ public class TestTableInputFormat {
|
||||||
Bytes.toBytes("columnB") };
|
Bytes.toBytes("columnB") };
|
||||||
// mandatory
|
// mandatory
|
||||||
setInputColumns(inputColumns);
|
setInputColumns(inputColumns);
|
||||||
Filter exampleFilter = new RowFilter(CompareOp.EQUAL, new RegexStringComparator("aa.*"));
|
Filter exampleFilter =
|
||||||
|
new RowFilter(CompareOperator.EQUAL, new RegexStringComparator("aa.*"));
|
||||||
// optional
|
// optional
|
||||||
setRowFilter(exampleFilter);
|
setRowFilter(exampleFilter);
|
||||||
} catch (IOException exception) {
|
} catch (IOException exception) {
|
||||||
|
@ -449,7 +450,8 @@ public class TestTableInputFormat {
|
||||||
Bytes.toBytes("columnB") };
|
Bytes.toBytes("columnB") };
|
||||||
// mandatory
|
// mandatory
|
||||||
setInputColumns(inputColumns);
|
setInputColumns(inputColumns);
|
||||||
Filter exampleFilter = new RowFilter(CompareOp.EQUAL, new RegexStringComparator("aa.*"));
|
Filter exampleFilter =
|
||||||
|
new RowFilter(CompareOperator.EQUAL, new RegexStringComparator("aa.*"));
|
||||||
// optional
|
// optional
|
||||||
setRowFilter(exampleFilter);
|
setRowFilter(exampleFilter);
|
||||||
}
|
}
|
||||||
|
|
|
@ -417,7 +417,8 @@ public class TestTableInputFormat {
|
||||||
for (byte[] family : inputColumns) {
|
for (byte[] family : inputColumns) {
|
||||||
scan.addFamily(family);
|
scan.addFamily(family);
|
||||||
}
|
}
|
||||||
Filter exampleFilter = new RowFilter(CompareOp.EQUAL, new RegexStringComparator("aa.*"));
|
Filter exampleFilter =
|
||||||
|
new RowFilter(CompareOperator.EQUAL, new RegexStringComparator("aa.*"));
|
||||||
scan.setFilter(exampleFilter);
|
scan.setFilter(exampleFilter);
|
||||||
setScan(scan);
|
setScan(scan);
|
||||||
} catch (IOException exception) {
|
} catch (IOException exception) {
|
||||||
|
@ -445,7 +446,8 @@ public class TestTableInputFormat {
|
||||||
for (byte[] family : inputColumns) {
|
for (byte[] family : inputColumns) {
|
||||||
scan.addFamily(family);
|
scan.addFamily(family);
|
||||||
}
|
}
|
||||||
Filter exampleFilter = new RowFilter(CompareOp.EQUAL, new RegexStringComparator("aa.*"));
|
Filter exampleFilter =
|
||||||
|
new RowFilter(CompareOperator.EQUAL, new RegexStringComparator("aa.*"));
|
||||||
scan.setFilter(exampleFilter);
|
scan.setFilter(exampleFilter);
|
||||||
setScan(scan);
|
setScan(scan);
|
||||||
} catch (IOException exception) {
|
} catch (IOException exception) {
|
||||||
|
@ -471,7 +473,8 @@ public class TestTableInputFormat {
|
||||||
for (byte[] family : inputColumns) {
|
for (byte[] family : inputColumns) {
|
||||||
scan.addFamily(family);
|
scan.addFamily(family);
|
||||||
}
|
}
|
||||||
Filter exampleFilter = new RowFilter(CompareOp.EQUAL, new RegexStringComparator("aa.*"));
|
Filter exampleFilter =
|
||||||
|
new RowFilter(CompareOperator.EQUAL, new RegexStringComparator("aa.*"));
|
||||||
scan.setFilter(exampleFilter);
|
scan.setFilter(exampleFilter);
|
||||||
setScan(scan);
|
setScan(scan);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.hbase.replication;
|
package org.apache.hadoop.hbase.replication;
|
||||||
|
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.shaded.com.google.common.util.concurrent.ThreadFactoryBuilder;
|
import org.apache.hadoop.hbase.shaded.com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.hbase.Abortable;
|
import org.apache.hadoop.hbase.Abortable;
|
||||||
|
@ -325,7 +326,7 @@ abstract class ReplicationTableBase {
|
||||||
protected ResultScanner getQueuesBelongingToServer(String server) throws IOException {
|
protected ResultScanner getQueuesBelongingToServer(String server) throws IOException {
|
||||||
Scan scan = new Scan();
|
Scan scan = new Scan();
|
||||||
SingleColumnValueFilter filterMyQueues = new SingleColumnValueFilter(CF_QUEUE, COL_QUEUE_OWNER,
|
SingleColumnValueFilter filterMyQueues = new SingleColumnValueFilter(CF_QUEUE, COL_QUEUE_OWNER,
|
||||||
CompareFilter.CompareOp.EQUAL, Bytes.toBytes(server));
|
CompareOperator.EQUAL, Bytes.toBytes(server));
|
||||||
scan.setFilter(filterMyQueues);
|
scan.setFilter(filterMyQueues);
|
||||||
scan.addColumn(CF_QUEUE, COL_QUEUE_OWNER);
|
scan.addColumn(CF_QUEUE, COL_QUEUE_OWNER);
|
||||||
scan.addColumn(CF_QUEUE, COL_QUEUE_OWNER_HISTORY);
|
scan.addColumn(CF_QUEUE, COL_QUEUE_OWNER_HISTORY);
|
||||||
|
|
|
@ -433,7 +433,7 @@ public class TableBasedReplicationQueuesImpl extends ReplicationTableBase
|
||||||
}
|
}
|
||||||
scan.setMaxResultSize(1);
|
scan.setMaxResultSize(1);
|
||||||
SingleColumnValueFilter checkOwner = new SingleColumnValueFilter(CF_QUEUE, COL_QUEUE_OWNER,
|
SingleColumnValueFilter checkOwner = new SingleColumnValueFilter(CF_QUEUE, COL_QUEUE_OWNER,
|
||||||
CompareFilter.CompareOp.EQUAL, serverNameBytes);
|
CompareOperator.EQUAL, serverNameBytes);
|
||||||
scan.setFilter(checkOwner);
|
scan.setFilter(checkOwner);
|
||||||
ResultScanner scanner = null;
|
ResultScanner scanner = null;
|
||||||
try (Table replicationTable = getOrBlockOnReplicationTable()) {
|
try (Table replicationTable = getOrBlockOnReplicationTable()) {
|
||||||
|
|
|
@ -31,6 +31,7 @@ import javax.xml.bind.annotation.XmlAttribute;
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.HConstants;
|
import org.apache.hadoop.hbase.HConstants;
|
||||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||||
import org.apache.hadoop.hbase.client.Scan;
|
import org.apache.hadoop.hbase.client.Scan;
|
||||||
|
@ -383,10 +384,10 @@ public class ScannerModel implements ProtobufMessageHandler, Serializable {
|
||||||
case DependentColumnFilter:
|
case DependentColumnFilter:
|
||||||
filter = new DependentColumnFilter(Base64.decode(family),
|
filter = new DependentColumnFilter(Base64.decode(family),
|
||||||
qualifier != null ? Base64.decode(qualifier) : null,
|
qualifier != null ? Base64.decode(qualifier) : null,
|
||||||
dropDependentColumn, CompareOp.valueOf(op), comparator.build());
|
dropDependentColumn, CompareOperator.valueOf(op), comparator.build());
|
||||||
break;
|
break;
|
||||||
case FamilyFilter:
|
case FamilyFilter:
|
||||||
filter = new FamilyFilter(CompareOp.valueOf(op), comparator.build());
|
filter = new FamilyFilter(CompareOperator.valueOf(op), comparator.build());
|
||||||
break;
|
break;
|
||||||
case FilterList: {
|
case FilterList: {
|
||||||
List<Filter> list = new ArrayList<>(filters.size());
|
List<Filter> list = new ArrayList<>(filters.size());
|
||||||
|
@ -421,18 +422,18 @@ public class ScannerModel implements ProtobufMessageHandler, Serializable {
|
||||||
filter = new PrefixFilter(Base64.decode(value));
|
filter = new PrefixFilter(Base64.decode(value));
|
||||||
break;
|
break;
|
||||||
case QualifierFilter:
|
case QualifierFilter:
|
||||||
filter = new QualifierFilter(CompareOp.valueOf(op), comparator.build());
|
filter = new QualifierFilter(CompareOperator.valueOf(op), comparator.build());
|
||||||
break;
|
break;
|
||||||
case RandomRowFilter:
|
case RandomRowFilter:
|
||||||
filter = new RandomRowFilter(chance);
|
filter = new RandomRowFilter(chance);
|
||||||
break;
|
break;
|
||||||
case RowFilter:
|
case RowFilter:
|
||||||
filter = new RowFilter(CompareOp.valueOf(op), comparator.build());
|
filter = new RowFilter(CompareOperator.valueOf(op), comparator.build());
|
||||||
break;
|
break;
|
||||||
case SingleColumnValueFilter:
|
case SingleColumnValueFilter:
|
||||||
filter = new SingleColumnValueFilter(Base64.decode(family),
|
filter = new SingleColumnValueFilter(Base64.decode(family),
|
||||||
qualifier != null ? Base64.decode(qualifier) : null,
|
qualifier != null ? Base64.decode(qualifier) : null,
|
||||||
CompareOp.valueOf(op), comparator.build());
|
CompareOperator.valueOf(op), comparator.build());
|
||||||
if (ifMissing != null) {
|
if (ifMissing != null) {
|
||||||
((SingleColumnValueFilter)filter).setFilterIfMissing(ifMissing);
|
((SingleColumnValueFilter)filter).setFilterIfMissing(ifMissing);
|
||||||
}
|
}
|
||||||
|
@ -443,7 +444,7 @@ public class ScannerModel implements ProtobufMessageHandler, Serializable {
|
||||||
case SingleColumnValueExcludeFilter:
|
case SingleColumnValueExcludeFilter:
|
||||||
filter = new SingleColumnValueExcludeFilter(Base64.decode(family),
|
filter = new SingleColumnValueExcludeFilter(Base64.decode(family),
|
||||||
qualifier != null ? Base64.decode(qualifier) : null,
|
qualifier != null ? Base64.decode(qualifier) : null,
|
||||||
CompareOp.valueOf(op), comparator.build());
|
CompareOperator.valueOf(op), comparator.build());
|
||||||
if (ifMissing != null) {
|
if (ifMissing != null) {
|
||||||
((SingleColumnValueExcludeFilter)filter).setFilterIfMissing(ifMissing);
|
((SingleColumnValueExcludeFilter)filter).setFilterIfMissing(ifMissing);
|
||||||
}
|
}
|
||||||
|
@ -458,7 +459,7 @@ public class ScannerModel implements ProtobufMessageHandler, Serializable {
|
||||||
filter = new TimestampsFilter(timestamps);
|
filter = new TimestampsFilter(timestamps);
|
||||||
break;
|
break;
|
||||||
case ValueFilter:
|
case ValueFilter:
|
||||||
filter = new ValueFilter(CompareOp.valueOf(op), comparator.build());
|
filter = new ValueFilter(CompareOperator.valueOf(op), comparator.build());
|
||||||
break;
|
break;
|
||||||
case WhileMatchFilter:
|
case WhileMatchFilter:
|
||||||
filter = new WhileMatchFilter(filters.get(0).build());
|
filter = new WhileMatchFilter(filters.get(0).build());
|
||||||
|
|
|
@ -42,6 +42,7 @@ import org.apache.hadoop.fs.FSDataInputStream;
|
||||||
import org.apache.hadoop.fs.FileStatus;
|
import org.apache.hadoop.fs.FileStatus;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||||
import org.apache.hadoop.hbase.HConstants;
|
import org.apache.hadoop.hbase.HConstants;
|
||||||
|
@ -1235,7 +1236,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
|
||||||
|
|
||||||
protected Scan constructScan(byte[] valuePrefix) throws IOException {
|
protected Scan constructScan(byte[] valuePrefix) throws IOException {
|
||||||
Filter filter = new SingleColumnValueFilter(
|
Filter filter = new SingleColumnValueFilter(
|
||||||
FAMILY_NAME, QUALIFIER_NAME, CompareFilter.CompareOp.EQUAL,
|
FAMILY_NAME, QUALIFIER_NAME, CompareOperator.EQUAL,
|
||||||
new BinaryComparator(valuePrefix)
|
new BinaryComparator(valuePrefix)
|
||||||
);
|
);
|
||||||
Scan scan = new Scan();
|
Scan scan = new Scan();
|
||||||
|
|
|
@ -37,6 +37,7 @@ import javax.xml.bind.Unmarshaller;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.hbase.CellUtil;
|
import org.apache.hadoop.hbase.CellUtil;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||||
import org.apache.hadoop.hbase.HConstants;
|
import org.apache.hadoop.hbase.HConstants;
|
||||||
|
@ -499,7 +500,7 @@ public class TestScannersWithFilters {
|
||||||
// Match two keys (one from each family) in half the rows
|
// Match two keys (one from each family) in half the rows
|
||||||
long expectedRows = numRows / 2;
|
long expectedRows = numRows / 2;
|
||||||
long expectedKeys = 2;
|
long expectedKeys = 2;
|
||||||
Filter f = new QualifierFilter(CompareOp.EQUAL,
|
Filter f = new QualifierFilter(CompareOperator.EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
||||||
Scan s = new Scan();
|
Scan s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -509,7 +510,7 @@ public class TestScannersWithFilters {
|
||||||
// Expect only two keys (one from each family) in half the rows
|
// Expect only two keys (one from each family) in half the rows
|
||||||
expectedRows = numRows / 2;
|
expectedRows = numRows / 2;
|
||||||
expectedKeys = 2;
|
expectedKeys = 2;
|
||||||
f = new QualifierFilter(CompareOp.LESS,
|
f = new QualifierFilter(CompareOperator.LESS,
|
||||||
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -519,7 +520,7 @@ public class TestScannersWithFilters {
|
||||||
// Expect four keys (two from each family) in half the rows
|
// Expect four keys (two from each family) in half the rows
|
||||||
expectedRows = numRows / 2;
|
expectedRows = numRows / 2;
|
||||||
expectedKeys = 4;
|
expectedKeys = 4;
|
||||||
f = new QualifierFilter(CompareOp.LESS_OR_EQUAL,
|
f = new QualifierFilter(CompareOperator.LESS_OR_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -530,7 +531,7 @@ public class TestScannersWithFilters {
|
||||||
// Only look in first group of rows
|
// Only look in first group of rows
|
||||||
expectedRows = numRows / 2;
|
expectedRows = numRows / 2;
|
||||||
expectedKeys = 4;
|
expectedKeys = 4;
|
||||||
f = new QualifierFilter(CompareOp.NOT_EQUAL,
|
f = new QualifierFilter(CompareOperator.NOT_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
||||||
s = new Scan(HConstants.EMPTY_START_ROW, Bytes.toBytes("testRowTwo"));
|
s = new Scan(HConstants.EMPTY_START_ROW, Bytes.toBytes("testRowTwo"));
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -541,7 +542,7 @@ public class TestScannersWithFilters {
|
||||||
// Only look in first group of rows
|
// Only look in first group of rows
|
||||||
expectedRows = numRows / 2;
|
expectedRows = numRows / 2;
|
||||||
expectedKeys = 4;
|
expectedKeys = 4;
|
||||||
f = new QualifierFilter(CompareOp.GREATER_OR_EQUAL,
|
f = new QualifierFilter(CompareOperator.GREATER_OR_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
||||||
s = new Scan(HConstants.EMPTY_START_ROW, Bytes.toBytes("testRowTwo"));
|
s = new Scan(HConstants.EMPTY_START_ROW, Bytes.toBytes("testRowTwo"));
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -552,7 +553,7 @@ public class TestScannersWithFilters {
|
||||||
// Only look in first group of rows
|
// Only look in first group of rows
|
||||||
expectedRows = numRows / 2;
|
expectedRows = numRows / 2;
|
||||||
expectedKeys = 2;
|
expectedKeys = 2;
|
||||||
f = new QualifierFilter(CompareOp.GREATER,
|
f = new QualifierFilter(CompareOperator.GREATER,
|
||||||
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
||||||
s = new Scan(HConstants.EMPTY_START_ROW, Bytes.toBytes("testRowTwo"));
|
s = new Scan(HConstants.EMPTY_START_ROW, Bytes.toBytes("testRowTwo"));
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -562,7 +563,7 @@ public class TestScannersWithFilters {
|
||||||
// Look across rows and fully validate the keys and ordering
|
// Look across rows and fully validate the keys and ordering
|
||||||
// Expect varied numbers of keys, 4 per row in group one, 6 per row in
|
// Expect varied numbers of keys, 4 per row in group one, 6 per row in
|
||||||
// group two
|
// group two
|
||||||
f = new QualifierFilter(CompareOp.NOT_EQUAL,
|
f = new QualifierFilter(CompareOperator.NOT_EQUAL,
|
||||||
new BinaryComparator(QUALIFIERS_ONE[2]));
|
new BinaryComparator(QUALIFIERS_ONE[2]));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -610,7 +611,7 @@ public class TestScannersWithFilters {
|
||||||
// Test across rows and groups with a regex
|
// Test across rows and groups with a regex
|
||||||
// Filter out "test*-2"
|
// Filter out "test*-2"
|
||||||
// Expect 4 keys per row across both groups
|
// Expect 4 keys per row across both groups
|
||||||
f = new QualifierFilter(CompareOp.NOT_EQUAL,
|
f = new QualifierFilter(CompareOperator.NOT_EQUAL,
|
||||||
new RegexStringComparator("test.+-2"));
|
new RegexStringComparator("test.+-2"));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -655,7 +656,7 @@ public class TestScannersWithFilters {
|
||||||
// Match a single row, all keys
|
// Match a single row, all keys
|
||||||
long expectedRows = 1;
|
long expectedRows = 1;
|
||||||
long expectedKeys = colsPerRow;
|
long expectedKeys = colsPerRow;
|
||||||
Filter f = new RowFilter(CompareOp.EQUAL,
|
Filter f = new RowFilter(CompareOperator.EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
||||||
Scan s = new Scan();
|
Scan s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -664,7 +665,7 @@ public class TestScannersWithFilters {
|
||||||
// Match a two rows, one from each group, using regex
|
// Match a two rows, one from each group, using regex
|
||||||
expectedRows = 2;
|
expectedRows = 2;
|
||||||
expectedKeys = colsPerRow;
|
expectedKeys = colsPerRow;
|
||||||
f = new RowFilter(CompareOp.EQUAL,
|
f = new RowFilter(CompareOperator.EQUAL,
|
||||||
new RegexStringComparator("testRow.+-2"));
|
new RegexStringComparator("testRow.+-2"));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -674,7 +675,7 @@ public class TestScannersWithFilters {
|
||||||
// Expect all keys in one row
|
// Expect all keys in one row
|
||||||
expectedRows = 1;
|
expectedRows = 1;
|
||||||
expectedKeys = colsPerRow;
|
expectedKeys = colsPerRow;
|
||||||
f = new RowFilter(CompareOp.LESS,
|
f = new RowFilter(CompareOperator.LESS,
|
||||||
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -684,7 +685,7 @@ public class TestScannersWithFilters {
|
||||||
// Expect all keys in two rows
|
// Expect all keys in two rows
|
||||||
expectedRows = 2;
|
expectedRows = 2;
|
||||||
expectedKeys = colsPerRow;
|
expectedKeys = colsPerRow;
|
||||||
f = new RowFilter(CompareOp.LESS_OR_EQUAL,
|
f = new RowFilter(CompareOperator.LESS_OR_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -694,7 +695,7 @@ public class TestScannersWithFilters {
|
||||||
// Expect all keys in all but one row
|
// Expect all keys in all but one row
|
||||||
expectedRows = numRows - 1;
|
expectedRows = numRows - 1;
|
||||||
expectedKeys = colsPerRow;
|
expectedKeys = colsPerRow;
|
||||||
f = new RowFilter(CompareOp.NOT_EQUAL,
|
f = new RowFilter(CompareOperator.NOT_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -704,7 +705,7 @@ public class TestScannersWithFilters {
|
||||||
// Expect all keys in all but one row
|
// Expect all keys in all but one row
|
||||||
expectedRows = numRows - 1;
|
expectedRows = numRows - 1;
|
||||||
expectedKeys = colsPerRow;
|
expectedKeys = colsPerRow;
|
||||||
f = new RowFilter(CompareOp.GREATER_OR_EQUAL,
|
f = new RowFilter(CompareOperator.GREATER_OR_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -714,7 +715,7 @@ public class TestScannersWithFilters {
|
||||||
// Expect all keys in all but two rows
|
// Expect all keys in all but two rows
|
||||||
expectedRows = numRows - 2;
|
expectedRows = numRows - 2;
|
||||||
expectedKeys = colsPerRow;
|
expectedKeys = colsPerRow;
|
||||||
f = new RowFilter(CompareOp.GREATER,
|
f = new RowFilter(CompareOperator.GREATER,
|
||||||
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -723,7 +724,7 @@ public class TestScannersWithFilters {
|
||||||
// Match rows not equal to testRowTwo-2
|
// Match rows not equal to testRowTwo-2
|
||||||
// Look across rows and fully validate the keys and ordering
|
// Look across rows and fully validate the keys and ordering
|
||||||
// Should see all keys in all rows but testRowTwo-2
|
// Should see all keys in all rows but testRowTwo-2
|
||||||
f = new RowFilter(CompareOp.NOT_EQUAL,
|
f = new RowFilter(CompareOperator.NOT_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -770,7 +771,7 @@ public class TestScannersWithFilters {
|
||||||
// Test across rows and groups with a regex
|
// Test across rows and groups with a regex
|
||||||
// Filter out everything that doesn't match "*-2"
|
// Filter out everything that doesn't match "*-2"
|
||||||
// Expect all keys in two rows
|
// Expect all keys in two rows
|
||||||
f = new RowFilter(CompareOp.EQUAL,
|
f = new RowFilter(CompareOperator.EQUAL,
|
||||||
new RegexStringComparator(".+-2"));
|
new RegexStringComparator(".+-2"));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -799,7 +800,7 @@ public class TestScannersWithFilters {
|
||||||
// Match group one rows
|
// Match group one rows
|
||||||
long expectedRows = numRows / 2;
|
long expectedRows = numRows / 2;
|
||||||
long expectedKeys = colsPerRow;
|
long expectedKeys = colsPerRow;
|
||||||
Filter f = new ValueFilter(CompareOp.EQUAL,
|
Filter f = new ValueFilter(CompareOperator.EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
||||||
Scan s = new Scan();
|
Scan s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -808,7 +809,7 @@ public class TestScannersWithFilters {
|
||||||
// Match group two rows
|
// Match group two rows
|
||||||
expectedRows = numRows / 2;
|
expectedRows = numRows / 2;
|
||||||
expectedKeys = colsPerRow;
|
expectedKeys = colsPerRow;
|
||||||
f = new ValueFilter(CompareOp.EQUAL,
|
f = new ValueFilter(CompareOperator.EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testValueTwo")));
|
new BinaryComparator(Bytes.toBytes("testValueTwo")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -817,7 +818,7 @@ public class TestScannersWithFilters {
|
||||||
// Match all values using regex
|
// Match all values using regex
|
||||||
expectedRows = numRows;
|
expectedRows = numRows;
|
||||||
expectedKeys = colsPerRow;
|
expectedKeys = colsPerRow;
|
||||||
f = new ValueFilter(CompareOp.EQUAL,
|
f = new ValueFilter(CompareOperator.EQUAL,
|
||||||
new RegexStringComparator("testValue((One)|(Two))"));
|
new RegexStringComparator("testValue((One)|(Two))"));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -827,7 +828,7 @@ public class TestScannersWithFilters {
|
||||||
// Expect group one rows
|
// Expect group one rows
|
||||||
expectedRows = numRows / 2;
|
expectedRows = numRows / 2;
|
||||||
expectedKeys = colsPerRow;
|
expectedKeys = colsPerRow;
|
||||||
f = new ValueFilter(CompareOp.LESS,
|
f = new ValueFilter(CompareOperator.LESS,
|
||||||
new BinaryComparator(Bytes.toBytes("testValueTwo")));
|
new BinaryComparator(Bytes.toBytes("testValueTwo")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -837,7 +838,7 @@ public class TestScannersWithFilters {
|
||||||
// Expect all rows
|
// Expect all rows
|
||||||
expectedRows = numRows;
|
expectedRows = numRows;
|
||||||
expectedKeys = colsPerRow;
|
expectedKeys = colsPerRow;
|
||||||
f = new ValueFilter(CompareOp.LESS_OR_EQUAL,
|
f = new ValueFilter(CompareOperator.LESS_OR_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testValueTwo")));
|
new BinaryComparator(Bytes.toBytes("testValueTwo")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -847,7 +848,7 @@ public class TestScannersWithFilters {
|
||||||
// Expect group one rows
|
// Expect group one rows
|
||||||
expectedRows = numRows / 2;
|
expectedRows = numRows / 2;
|
||||||
expectedKeys = colsPerRow;
|
expectedKeys = colsPerRow;
|
||||||
f = new ValueFilter(CompareOp.LESS_OR_EQUAL,
|
f = new ValueFilter(CompareOperator.LESS_OR_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -857,7 +858,7 @@ public class TestScannersWithFilters {
|
||||||
// Expect half the rows
|
// Expect half the rows
|
||||||
expectedRows = numRows / 2;
|
expectedRows = numRows / 2;
|
||||||
expectedKeys = colsPerRow;
|
expectedKeys = colsPerRow;
|
||||||
f = new ValueFilter(CompareOp.NOT_EQUAL,
|
f = new ValueFilter(CompareOperator.NOT_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -867,7 +868,7 @@ public class TestScannersWithFilters {
|
||||||
// Expect all rows
|
// Expect all rows
|
||||||
expectedRows = numRows;
|
expectedRows = numRows;
|
||||||
expectedKeys = colsPerRow;
|
expectedKeys = colsPerRow;
|
||||||
f = new ValueFilter(CompareOp.GREATER_OR_EQUAL,
|
f = new ValueFilter(CompareOperator.GREATER_OR_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -877,7 +878,7 @@ public class TestScannersWithFilters {
|
||||||
// Expect half rows
|
// Expect half rows
|
||||||
expectedRows = numRows / 2;
|
expectedRows = numRows / 2;
|
||||||
expectedKeys = colsPerRow;
|
expectedKeys = colsPerRow;
|
||||||
f = new ValueFilter(CompareOp.GREATER,
|
f = new ValueFilter(CompareOperator.GREATER,
|
||||||
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -886,7 +887,7 @@ public class TestScannersWithFilters {
|
||||||
// Match values not equal to testValueOne
|
// Match values not equal to testValueOne
|
||||||
// Look across rows and fully validate the keys and ordering
|
// Look across rows and fully validate the keys and ordering
|
||||||
// Should see all keys in all group two rows
|
// Should see all keys in all group two rows
|
||||||
f = new ValueFilter(CompareOp.NOT_EQUAL,
|
f = new ValueFilter(CompareOperator.NOT_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -921,7 +922,7 @@ public class TestScannersWithFilters {
|
||||||
public void testSkipFilter() throws Exception {
|
public void testSkipFilter() throws Exception {
|
||||||
// Test for qualifier regex: "testQualifierOne-2"
|
// Test for qualifier regex: "testQualifierOne-2"
|
||||||
// Should only get rows from second group, and all keys
|
// Should only get rows from second group, and all keys
|
||||||
Filter f = new SkipFilter(new QualifierFilter(CompareOp.NOT_EQUAL,
|
Filter f = new SkipFilter(new QualifierFilter(CompareOperator.NOT_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testQualifierOne-2"))));
|
new BinaryComparator(Bytes.toBytes("testQualifierOne-2"))));
|
||||||
Scan s = new Scan();
|
Scan s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -958,11 +959,11 @@ public class TestScannersWithFilters {
|
||||||
// regular expression and substring filters
|
// regular expression and substring filters
|
||||||
// Use must pass all
|
// Use must pass all
|
||||||
List<Filter> filters = new ArrayList<>(3);
|
List<Filter> filters = new ArrayList<>(3);
|
||||||
filters.add(new RowFilter(CompareOp.EQUAL,
|
filters.add(new RowFilter(CompareOperator.EQUAL,
|
||||||
new RegexStringComparator(".+-2")));
|
new RegexStringComparator(".+-2")));
|
||||||
filters.add(new QualifierFilter(CompareOp.EQUAL,
|
filters.add(new QualifierFilter(CompareOperator.EQUAL,
|
||||||
new RegexStringComparator(".+-2")));
|
new RegexStringComparator(".+-2")));
|
||||||
filters.add(new ValueFilter(CompareOp.EQUAL,
|
filters.add(new ValueFilter(CompareOperator.EQUAL,
|
||||||
new SubstringComparator("One")));
|
new SubstringComparator("One")));
|
||||||
Filter f = new FilterList(Operator.MUST_PASS_ALL, filters);
|
Filter f = new FilterList(Operator.MUST_PASS_ALL, filters);
|
||||||
Scan s = new Scan();
|
Scan s = new Scan();
|
||||||
|
@ -976,11 +977,11 @@ public class TestScannersWithFilters {
|
||||||
// Test getting everything with a MUST_PASS_ONE filter including row, qf,
|
// Test getting everything with a MUST_PASS_ONE filter including row, qf,
|
||||||
// val, regular expression and substring filters
|
// val, regular expression and substring filters
|
||||||
filters.clear();
|
filters.clear();
|
||||||
filters.add(new RowFilter(CompareOp.EQUAL,
|
filters.add(new RowFilter(CompareOperator.EQUAL,
|
||||||
new RegexStringComparator(".+Two.+")));
|
new RegexStringComparator(".+Two.+")));
|
||||||
filters.add(new QualifierFilter(CompareOp.EQUAL,
|
filters.add(new QualifierFilter(CompareOperator.EQUAL,
|
||||||
new RegexStringComparator(".+-2")));
|
new RegexStringComparator(".+-2")));
|
||||||
filters.add(new ValueFilter(CompareOp.EQUAL,
|
filters.add(new ValueFilter(CompareOperator.EQUAL,
|
||||||
new SubstringComparator("One")));
|
new SubstringComparator("One")));
|
||||||
f = new FilterList(Operator.MUST_PASS_ONE, filters);
|
f = new FilterList(Operator.MUST_PASS_ONE, filters);
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
|
@ -1003,6 +1004,4 @@ public class TestScannersWithFilters {
|
||||||
};
|
};
|
||||||
verifyScanFull(s, kvs);
|
verifyScanFull(s, kvs);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package org.apache.hadoop.hbase.security.access;
|
package org.apache.hadoop.hbase.security.access;
|
||||||
|
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.shaded.com.google.common.collect.ArrayListMultimap;
|
import org.apache.hadoop.hbase.shaded.com.google.common.collect.ArrayListMultimap;
|
||||||
import org.apache.hadoop.hbase.shaded.com.google.common.collect.ListMultimap;
|
import org.apache.hadoop.hbase.shaded.com.google.common.collect.ListMultimap;
|
||||||
import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
|
import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
|
||||||
|
@ -323,7 +324,7 @@ public class AccessControlLists {
|
||||||
scan.addFamily(ACL_LIST_FAMILY);
|
scan.addFamily(ACL_LIST_FAMILY);
|
||||||
|
|
||||||
String columnName = Bytes.toString(column);
|
String columnName = Bytes.toString(column);
|
||||||
scan.setFilter(new QualifierFilter(CompareOp.EQUAL, new RegexStringComparator(
|
scan.setFilter(new QualifierFilter(CompareOperator.EQUAL, new RegexStringComparator(
|
||||||
String.format("(%s%s%s)|(%s%s)$",
|
String.format("(%s%s%s)|(%s%s)$",
|
||||||
ACL_KEY_DELIMITER, columnName, ACL_KEY_DELIMITER,
|
ACL_KEY_DELIMITER, columnName, ACL_KEY_DELIMITER,
|
||||||
ACL_KEY_DELIMITER, columnName))));
|
ACL_KEY_DELIMITER, columnName))));
|
||||||
|
|
|
@ -131,7 +131,7 @@ public class TestSerialization {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test public void testCompareFilter() throws Exception {
|
@Test public void testCompareFilter() throws Exception {
|
||||||
Filter f = new RowFilter(CompareOp.EQUAL,
|
Filter f = new RowFilter(CompareOperator.EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
||||||
byte [] bytes = f.toByteArray();
|
byte [] bytes = f.toByteArray();
|
||||||
Filter ff = RowFilter.parseFrom(bytes);
|
Filter ff = RowFilter.parseFrom(bytes);
|
||||||
|
|
|
@ -205,21 +205,21 @@ public class TestServerSideScanMetricsFromClientSide {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The filter should filter out all rows, but we still expect to see every row.
|
// The filter should filter out all rows, but we still expect to see every row.
|
||||||
Filter filter = new RowFilter(CompareOp.EQUAL, new BinaryComparator("xyz".getBytes()));
|
Filter filter = new RowFilter(CompareOperator.EQUAL, new BinaryComparator("xyz".getBytes()));
|
||||||
scan = new Scan(baseScan);
|
scan = new Scan(baseScan);
|
||||||
scan.setFilter(filter);
|
scan.setFilter(filter);
|
||||||
testMetric(scan, ServerSideScanMetrics.COUNT_OF_ROWS_SCANNED_KEY_METRIC_NAME, ROWS.length);
|
testMetric(scan, ServerSideScanMetrics.COUNT_OF_ROWS_SCANNED_KEY_METRIC_NAME, ROWS.length);
|
||||||
|
|
||||||
// Filter should pass on all rows
|
// Filter should pass on all rows
|
||||||
SingleColumnValueFilter singleColumnValueFilter =
|
SingleColumnValueFilter singleColumnValueFilter =
|
||||||
new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS[0], CompareOp.EQUAL, VALUE);
|
new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS[0], CompareOperator.EQUAL, VALUE);
|
||||||
scan = new Scan(baseScan);
|
scan = new Scan(baseScan);
|
||||||
scan.setFilter(singleColumnValueFilter);
|
scan.setFilter(singleColumnValueFilter);
|
||||||
testMetric(scan, ServerSideScanMetrics.COUNT_OF_ROWS_SCANNED_KEY_METRIC_NAME, ROWS.length);
|
testMetric(scan, ServerSideScanMetrics.COUNT_OF_ROWS_SCANNED_KEY_METRIC_NAME, ROWS.length);
|
||||||
|
|
||||||
// Filter should filter out all rows
|
// Filter should filter out all rows
|
||||||
singleColumnValueFilter =
|
singleColumnValueFilter =
|
||||||
new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS[0], CompareOp.NOT_EQUAL, VALUE);
|
new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS[0], CompareOperator.NOT_EQUAL, VALUE);
|
||||||
scan = new Scan(baseScan);
|
scan = new Scan(baseScan);
|
||||||
scan.setFilter(singleColumnValueFilter);
|
scan.setFilter(singleColumnValueFilter);
|
||||||
testMetric(scan, ServerSideScanMetrics.COUNT_OF_ROWS_SCANNED_KEY_METRIC_NAME, ROWS.length);
|
testMetric(scan, ServerSideScanMetrics.COUNT_OF_ROWS_SCANNED_KEY_METRIC_NAME, ROWS.length);
|
||||||
|
@ -255,7 +255,7 @@ public class TestServerSideScanMetricsFromClientSide {
|
||||||
testRowsFilteredMetric(baseScan, null, 0);
|
testRowsFilteredMetric(baseScan, null, 0);
|
||||||
|
|
||||||
// Row filter doesn't match any row key. All rows should be filtered
|
// Row filter doesn't match any row key. All rows should be filtered
|
||||||
Filter filter = new RowFilter(CompareOp.EQUAL, new BinaryComparator("xyz".getBytes()));
|
Filter filter = new RowFilter(CompareOperator.EQUAL, new BinaryComparator("xyz".getBytes()));
|
||||||
testRowsFilteredMetric(baseScan, filter, ROWS.length);
|
testRowsFilteredMetric(baseScan, filter, ROWS.length);
|
||||||
|
|
||||||
// Filter will return results containing only the first key. Number of entire rows filtered
|
// Filter will return results containing only the first key. Number of entire rows filtered
|
||||||
|
@ -273,16 +273,17 @@ public class TestServerSideScanMetricsFromClientSide {
|
||||||
testRowsFilteredMetric(baseScan, filter, ROWS.length);
|
testRowsFilteredMetric(baseScan, filter, ROWS.length);
|
||||||
|
|
||||||
// Matching column value should exist in each row. No rows should be filtered.
|
// Matching column value should exist in each row. No rows should be filtered.
|
||||||
filter = new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS[0], CompareOp.EQUAL, VALUE);
|
filter = new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS[0], CompareOperator.EQUAL, VALUE);
|
||||||
testRowsFilteredMetric(baseScan, filter, 0);
|
testRowsFilteredMetric(baseScan, filter, 0);
|
||||||
|
|
||||||
// No matching column value should exist in any row. Filter all rows
|
// No matching column value should exist in any row. Filter all rows
|
||||||
filter = new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS[0], CompareOp.NOT_EQUAL, VALUE);
|
filter = new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS[0],
|
||||||
|
CompareOperator.NOT_EQUAL, VALUE);
|
||||||
testRowsFilteredMetric(baseScan, filter, ROWS.length);
|
testRowsFilteredMetric(baseScan, filter, ROWS.length);
|
||||||
|
|
||||||
List<Filter> filters = new ArrayList<>();
|
List<Filter> filters = new ArrayList<>();
|
||||||
filters.add(new RowFilter(CompareOp.EQUAL, new BinaryComparator(ROWS[0])));
|
filters.add(new RowFilter(CompareOperator.EQUAL, new BinaryComparator(ROWS[0])));
|
||||||
filters.add(new RowFilter(CompareOp.EQUAL, new BinaryComparator(ROWS[3])));
|
filters.add(new RowFilter(CompareOperator.EQUAL, new BinaryComparator(ROWS[3])));
|
||||||
int numberOfMatchingRowFilters = filters.size();
|
int numberOfMatchingRowFilters = filters.size();
|
||||||
filter = new FilterList(Operator.MUST_PASS_ONE, filters);
|
filter = new FilterList(Operator.MUST_PASS_ONE, filters);
|
||||||
testRowsFilteredMetric(baseScan, filter, ROWS.length - numberOfMatchingRowFilters);
|
testRowsFilteredMetric(baseScan, filter, ROWS.length - numberOfMatchingRowFilters);
|
||||||
|
@ -294,7 +295,7 @@ public class TestServerSideScanMetricsFromClientSide {
|
||||||
for (int family = 0; family < FAMILIES.length; family++) {
|
for (int family = 0; family < FAMILIES.length; family++) {
|
||||||
for (int qualifier = 0; qualifier < QUALIFIERS.length; qualifier++) {
|
for (int qualifier = 0; qualifier < QUALIFIERS.length; qualifier++) {
|
||||||
filters.add(new SingleColumnValueExcludeFilter(FAMILIES[family], QUALIFIERS[qualifier],
|
filters.add(new SingleColumnValueExcludeFilter(FAMILIES[family], QUALIFIERS[qualifier],
|
||||||
CompareOp.EQUAL, VALUE));
|
CompareOperator.EQUAL, VALUE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
filter = new FilterList(Operator.MUST_PASS_ONE, filters);
|
filter = new FilterList(Operator.MUST_PASS_ONE, filters);
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class TestCheckAndMutate {
|
||||||
// put the same row again with C column deleted
|
// put the same row again with C column deleted
|
||||||
RowMutations rm = makeRowMutationsWithColumnCDeleted();
|
RowMutations rm = makeRowMutationsWithColumnCDeleted();
|
||||||
boolean res = table.checkAndMutate(ROWKEY, FAMILY, Bytes.toBytes("A"),
|
boolean res = table.checkAndMutate(ROWKEY, FAMILY, Bytes.toBytes("A"),
|
||||||
CompareFilter.CompareOp.EQUAL, Bytes.toBytes("a"), rm);
|
CompareOperator.EQUAL, Bytes.toBytes("a"), rm);
|
||||||
assertTrue(res);
|
assertTrue(res);
|
||||||
|
|
||||||
// get row back and assert the values
|
// get row back and assert the values
|
||||||
|
@ -141,7 +141,7 @@ public class TestCheckAndMutate {
|
||||||
//Test that we get a region level exception
|
//Test that we get a region level exception
|
||||||
try {
|
try {
|
||||||
rm = getBogusRowMutations();
|
rm = getBogusRowMutations();
|
||||||
table.checkAndMutate(ROWKEY, FAMILY, Bytes.toBytes("A"), CompareFilter.CompareOp.EQUAL,
|
table.checkAndMutate(ROWKEY, FAMILY, Bytes.toBytes("A"), CompareOperator.EQUAL,
|
||||||
Bytes.toBytes("a"), rm);
|
Bytes.toBytes("a"), rm);
|
||||||
fail("Expected NoSuchColumnFamilyException");
|
fail("Expected NoSuchColumnFamilyException");
|
||||||
} catch (RetriesExhaustedWithDetailsException e) {
|
} catch (RetriesExhaustedWithDetailsException e) {
|
||||||
|
|
|
@ -53,6 +53,7 @@ import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.hbase.Cell;
|
import org.apache.hadoop.hbase.Cell;
|
||||||
import org.apache.hadoop.hbase.CellUtil;
|
import org.apache.hadoop.hbase.CellUtil;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.DoNotRetryIOException;
|
import org.apache.hadoop.hbase.DoNotRetryIOException;
|
||||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||||
|
@ -453,7 +454,7 @@ public class TestFromClientSide {
|
||||||
FilterList allFilters = new FilterList(/* FilterList.Operator.MUST_PASS_ALL */);
|
FilterList allFilters = new FilterList(/* FilterList.Operator.MUST_PASS_ALL */);
|
||||||
allFilters.addFilter(new PrefixFilter(Bytes.toBytes(keyPrefix)));
|
allFilters.addFilter(new PrefixFilter(Bytes.toBytes(keyPrefix)));
|
||||||
SingleColumnValueFilter filter = new SingleColumnValueFilter(Bytes
|
SingleColumnValueFilter filter = new SingleColumnValueFilter(Bytes
|
||||||
.toBytes("trans-tags"), Bytes.toBytes("qual2"), CompareOp.EQUAL, Bytes
|
.toBytes("trans-tags"), Bytes.toBytes("qual2"), CompareOperator.EQUAL, Bytes
|
||||||
.toBytes(value));
|
.toBytes(value));
|
||||||
filter.setFilterIfMissing(true);
|
filter.setFilterIfMissing(true);
|
||||||
allFilters.addFilter(filter);
|
allFilters.addFilter(filter);
|
||||||
|
@ -542,15 +543,15 @@ public class TestFromClientSide {
|
||||||
|
|
||||||
key = new byte [] {'a', 'a', 'a'};
|
key = new byte [] {'a', 'a', 'a'};
|
||||||
int countBBB = TEST_UTIL.countRows(t,
|
int countBBB = TEST_UTIL.countRows(t,
|
||||||
createScanWithRowFilter(key, null, CompareFilter.CompareOp.EQUAL));
|
createScanWithRowFilter(key, null, CompareOperator.EQUAL));
|
||||||
assertEquals(1, countBBB);
|
assertEquals(1, countBBB);
|
||||||
|
|
||||||
int countGreater = TEST_UTIL.countRows(t, createScanWithRowFilter(endKey, null,
|
int countGreater = TEST_UTIL.countRows(t, createScanWithRowFilter(endKey, null,
|
||||||
CompareFilter.CompareOp.GREATER_OR_EQUAL));
|
CompareOperator.GREATER_OR_EQUAL));
|
||||||
// Because started at start of table.
|
// Because started at start of table.
|
||||||
assertEquals(0, countGreater);
|
assertEquals(0, countGreater);
|
||||||
countGreater = TEST_UTIL.countRows(t, createScanWithRowFilter(endKey, endKey,
|
countGreater = TEST_UTIL.countRows(t, createScanWithRowFilter(endKey, endKey,
|
||||||
CompareFilter.CompareOp.GREATER_OR_EQUAL));
|
CompareOperator.GREATER_OR_EQUAL));
|
||||||
assertEquals(rowCount - endKeyCount, countGreater);
|
assertEquals(rowCount - endKeyCount, countGreater);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -694,7 +695,7 @@ public class TestFromClientSide {
|
||||||
* @return Scan with RowFilter that does LESS than passed key.
|
* @return Scan with RowFilter that does LESS than passed key.
|
||||||
*/
|
*/
|
||||||
private Scan createScanWithRowFilter(final byte [] key) {
|
private Scan createScanWithRowFilter(final byte [] key) {
|
||||||
return createScanWithRowFilter(key, null, CompareFilter.CompareOp.LESS);
|
return createScanWithRowFilter(key, null, CompareOperator.LESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -704,7 +705,7 @@ public class TestFromClientSide {
|
||||||
* @return Scan with RowFilter that does CompareOp op on passed key.
|
* @return Scan with RowFilter that does CompareOp op on passed key.
|
||||||
*/
|
*/
|
||||||
private Scan createScanWithRowFilter(final byte [] key,
|
private Scan createScanWithRowFilter(final byte [] key,
|
||||||
final byte [] startRow, CompareFilter.CompareOp op) {
|
final byte [] startRow, CompareOperator op) {
|
||||||
// Make sure key is of some substance... non-null and > than first key.
|
// Make sure key is of some substance... non-null and > than first key.
|
||||||
assertTrue(key != null && key.length > 0 &&
|
assertTrue(key != null && key.length > 0 &&
|
||||||
Bytes.BYTES_COMPARATOR.compare(key, new byte [] {'a', 'a', 'a'}) >= 0);
|
Bytes.BYTES_COMPARATOR.compare(key, new byte [] {'a', 'a', 'a'}) >= 0);
|
||||||
|
@ -826,7 +827,7 @@ public class TestFromClientSide {
|
||||||
}
|
}
|
||||||
Scan scan = new Scan();
|
Scan scan = new Scan();
|
||||||
scan.addFamily(FAMILY);
|
scan.addFamily(FAMILY);
|
||||||
Filter filter = new QualifierFilter(CompareOp.EQUAL,
|
Filter filter = new QualifierFilter(CompareOperator.EQUAL,
|
||||||
new RegexStringComparator("col[1-5]"));
|
new RegexStringComparator("col[1-5]"));
|
||||||
scan.setFilter(filter);
|
scan.setFilter(filter);
|
||||||
ResultScanner scanner = ht.getScanner(scan);
|
ResultScanner scanner = ht.getScanner(scan);
|
||||||
|
@ -859,7 +860,7 @@ public class TestFromClientSide {
|
||||||
}
|
}
|
||||||
Scan scan = new Scan();
|
Scan scan = new Scan();
|
||||||
scan.addFamily(FAMILY);
|
scan.addFamily(FAMILY);
|
||||||
Filter filter = new SingleColumnValueFilter(FAMILY, QUALIFIER, CompareOp.GREATER,
|
Filter filter = new SingleColumnValueFilter(FAMILY, QUALIFIER, CompareOperator.GREATER,
|
||||||
new LongComparator(500));
|
new LongComparator(500));
|
||||||
scan.setFilter(filter);
|
scan.setFilter(filter);
|
||||||
ResultScanner scanner = ht.getScanner(scan);
|
ResultScanner scanner = ht.getScanner(scan);
|
||||||
|
@ -1478,7 +1479,7 @@ public class TestFromClientSide {
|
||||||
|
|
||||||
RowMutations mutate = new RowMutations(ROW);
|
RowMutations mutate = new RowMutations(ROW);
|
||||||
mutate.add(new Put(ROW).addColumn(FAMILY, null, Bytes.toBytes("checkAndMutate")));
|
mutate.add(new Put(ROW).addColumn(FAMILY, null, Bytes.toBytes("checkAndMutate")));
|
||||||
table.checkAndMutate(ROW, FAMILY, null, CompareOp.EQUAL, Bytes.toBytes("checkAndPut"), mutate);
|
table.checkAndMutate(ROW, FAMILY, null, CompareOperator.EQUAL, Bytes.toBytes("checkAndPut"), mutate);
|
||||||
|
|
||||||
delete = new Delete(ROW);
|
delete = new Delete(ROW);
|
||||||
delete.addColumns(FAMILY, null);
|
delete.addColumns(FAMILY, null);
|
||||||
|
@ -4913,47 +4914,47 @@ public class TestFromClientSide {
|
||||||
|
|
||||||
// cell = "bbbb", using "aaaa" to compare only LESS/LESS_OR_EQUAL/NOT_EQUAL
|
// cell = "bbbb", using "aaaa" to compare only LESS/LESS_OR_EQUAL/NOT_EQUAL
|
||||||
// turns out "match"
|
// turns out "match"
|
||||||
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOp.GREATER, value1, put2);
|
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOperator.GREATER, value1, put2);
|
||||||
assertEquals(ok, false);
|
assertEquals(ok, false);
|
||||||
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOp.EQUAL, value1, put2);
|
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOperator.EQUAL, value1, put2);
|
||||||
assertEquals(ok, false);
|
assertEquals(ok, false);
|
||||||
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOp.GREATER_OR_EQUAL, value1, put2);
|
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOperator.GREATER_OR_EQUAL, value1, put2);
|
||||||
assertEquals(ok, false);
|
assertEquals(ok, false);
|
||||||
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOp.LESS, value1, put2);
|
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOperator.LESS, value1, put2);
|
||||||
assertEquals(ok, true);
|
assertEquals(ok, true);
|
||||||
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOp.LESS_OR_EQUAL, value1, put2);
|
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOperator.LESS_OR_EQUAL, value1, put2);
|
||||||
assertEquals(ok, true);
|
assertEquals(ok, true);
|
||||||
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOp.NOT_EQUAL, value1, put3);
|
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOperator.NOT_EQUAL, value1, put3);
|
||||||
assertEquals(ok, true);
|
assertEquals(ok, true);
|
||||||
|
|
||||||
// cell = "cccc", using "dddd" to compare only LARGER/LARGER_OR_EQUAL/NOT_EQUAL
|
// cell = "cccc", using "dddd" to compare only LARGER/LARGER_OR_EQUAL/NOT_EQUAL
|
||||||
// turns out "match"
|
// turns out "match"
|
||||||
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOp.LESS, value4, put3);
|
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOperator.LESS, value4, put3);
|
||||||
assertEquals(ok, false);
|
assertEquals(ok, false);
|
||||||
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOp.LESS_OR_EQUAL, value4, put3);
|
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOperator.LESS_OR_EQUAL, value4, put3);
|
||||||
assertEquals(ok, false);
|
assertEquals(ok, false);
|
||||||
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOp.EQUAL, value4, put3);
|
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOperator.EQUAL, value4, put3);
|
||||||
assertEquals(ok, false);
|
assertEquals(ok, false);
|
||||||
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOp.GREATER, value4, put3);
|
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOperator.GREATER, value4, put3);
|
||||||
assertEquals(ok, true);
|
assertEquals(ok, true);
|
||||||
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOp.GREATER_OR_EQUAL, value4, put3);
|
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOperator.GREATER_OR_EQUAL, value4, put3);
|
||||||
assertEquals(ok, true);
|
assertEquals(ok, true);
|
||||||
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOp.NOT_EQUAL, value4, put2);
|
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOperator.NOT_EQUAL, value4, put2);
|
||||||
assertEquals(ok, true);
|
assertEquals(ok, true);
|
||||||
|
|
||||||
// cell = "bbbb", using "bbbb" to compare only GREATER_OR_EQUAL/LESS_OR_EQUAL/EQUAL
|
// cell = "bbbb", using "bbbb" to compare only GREATER_OR_EQUAL/LESS_OR_EQUAL/EQUAL
|
||||||
// turns out "match"
|
// turns out "match"
|
||||||
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOp.GREATER, value2, put2);
|
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOperator.GREATER, value2, put2);
|
||||||
assertEquals(ok, false);
|
assertEquals(ok, false);
|
||||||
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOp.NOT_EQUAL, value2, put2);
|
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOperator.NOT_EQUAL, value2, put2);
|
||||||
assertEquals(ok, false);
|
assertEquals(ok, false);
|
||||||
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOp.LESS, value2, put2);
|
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOperator.LESS, value2, put2);
|
||||||
assertEquals(ok, false);
|
assertEquals(ok, false);
|
||||||
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOp.GREATER_OR_EQUAL, value2, put2);
|
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOperator.GREATER_OR_EQUAL, value2, put2);
|
||||||
assertEquals(ok, true);
|
assertEquals(ok, true);
|
||||||
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOp.LESS_OR_EQUAL, value2, put2);
|
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOperator.LESS_OR_EQUAL, value2, put2);
|
||||||
assertEquals(ok, true);
|
assertEquals(ok, true);
|
||||||
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOp.EQUAL, value2, put3);
|
ok = table.checkAndPut(ROW, FAMILY, QUALIFIER, CompareOperator.EQUAL, value2, put3);
|
||||||
assertEquals(ok, true);
|
assertEquals(ok, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4997,55 +4998,55 @@ public class TestFromClientSide {
|
||||||
|
|
||||||
// cell = "bbbb", using "aaaa" to compare only LESS/LESS_OR_EQUAL/NOT_EQUAL
|
// cell = "bbbb", using "aaaa" to compare only LESS/LESS_OR_EQUAL/NOT_EQUAL
|
||||||
// turns out "match"
|
// turns out "match"
|
||||||
boolean ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOp.GREATER, value1, delete);
|
boolean ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOperator.GREATER, value1, delete);
|
||||||
assertEquals(ok, false);
|
assertEquals(ok, false);
|
||||||
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOp.EQUAL, value1, delete);
|
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOperator.EQUAL, value1, delete);
|
||||||
assertEquals(ok, false);
|
assertEquals(ok, false);
|
||||||
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOp.GREATER_OR_EQUAL, value1, delete);
|
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOperator.GREATER_OR_EQUAL, value1, delete);
|
||||||
assertEquals(ok, false);
|
assertEquals(ok, false);
|
||||||
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOp.LESS, value1, delete);
|
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOperator.LESS, value1, delete);
|
||||||
assertEquals(ok, true);
|
assertEquals(ok, true);
|
||||||
table.put(put2);
|
table.put(put2);
|
||||||
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOp.LESS_OR_EQUAL, value1, delete);
|
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOperator.LESS_OR_EQUAL, value1, delete);
|
||||||
assertEquals(ok, true);
|
assertEquals(ok, true);
|
||||||
table.put(put2);
|
table.put(put2);
|
||||||
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOp.NOT_EQUAL, value1, delete);
|
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOperator.NOT_EQUAL, value1, delete);
|
||||||
assertEquals(ok, true);
|
assertEquals(ok, true);
|
||||||
|
|
||||||
// cell = "cccc", using "dddd" to compare only LARGER/LARGER_OR_EQUAL/NOT_EQUAL
|
// cell = "cccc", using "dddd" to compare only LARGER/LARGER_OR_EQUAL/NOT_EQUAL
|
||||||
// turns out "match"
|
// turns out "match"
|
||||||
table.put(put3);
|
table.put(put3);
|
||||||
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOp.LESS, value4, delete);
|
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOperator.LESS, value4, delete);
|
||||||
assertEquals(ok, false);
|
assertEquals(ok, false);
|
||||||
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOp.LESS_OR_EQUAL, value4, delete);
|
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOperator.LESS_OR_EQUAL, value4, delete);
|
||||||
assertEquals(ok, false);
|
assertEquals(ok, false);
|
||||||
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOp.EQUAL, value4, delete);
|
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOperator.EQUAL, value4, delete);
|
||||||
assertEquals(ok, false);
|
assertEquals(ok, false);
|
||||||
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOp.GREATER, value4, delete);
|
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOperator.GREATER, value4, delete);
|
||||||
assertEquals(ok, true);
|
assertEquals(ok, true);
|
||||||
table.put(put3);
|
table.put(put3);
|
||||||
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOp.GREATER_OR_EQUAL, value4, delete);
|
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOperator.GREATER_OR_EQUAL, value4, delete);
|
||||||
assertEquals(ok, true);
|
assertEquals(ok, true);
|
||||||
table.put(put3);
|
table.put(put3);
|
||||||
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOp.NOT_EQUAL, value4, delete);
|
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOperator.NOT_EQUAL, value4, delete);
|
||||||
assertEquals(ok, true);
|
assertEquals(ok, true);
|
||||||
|
|
||||||
// cell = "bbbb", using "bbbb" to compare only GREATER_OR_EQUAL/LESS_OR_EQUAL/EQUAL
|
// cell = "bbbb", using "bbbb" to compare only GREATER_OR_EQUAL/LESS_OR_EQUAL/EQUAL
|
||||||
// turns out "match"
|
// turns out "match"
|
||||||
table.put(put2);
|
table.put(put2);
|
||||||
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOp.GREATER, value2, delete);
|
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOperator.GREATER, value2, delete);
|
||||||
assertEquals(ok, false);
|
assertEquals(ok, false);
|
||||||
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOp.NOT_EQUAL, value2, delete);
|
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOperator.NOT_EQUAL, value2, delete);
|
||||||
assertEquals(ok, false);
|
assertEquals(ok, false);
|
||||||
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOp.LESS, value2, delete);
|
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOperator.LESS, value2, delete);
|
||||||
assertEquals(ok, false);
|
assertEquals(ok, false);
|
||||||
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOp.GREATER_OR_EQUAL, value2, delete);
|
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOperator.GREATER_OR_EQUAL, value2, delete);
|
||||||
assertEquals(ok, true);
|
assertEquals(ok, true);
|
||||||
table.put(put2);
|
table.put(put2);
|
||||||
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOp.LESS_OR_EQUAL, value2, delete);
|
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOperator.LESS_OR_EQUAL, value2, delete);
|
||||||
assertEquals(ok, true);
|
assertEquals(ok, true);
|
||||||
table.put(put2);
|
table.put(put2);
|
||||||
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOp.EQUAL, value2, delete);
|
ok = table.checkAndDelete(ROW, FAMILY, QUALIFIER, CompareOperator.EQUAL, value2, delete);
|
||||||
assertEquals(ok, true);
|
assertEquals(ok, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5450,7 +5451,7 @@ public class TestFromClientSide {
|
||||||
scan.setStartRow(Bytes.toBytes(1));
|
scan.setStartRow(Bytes.toBytes(1));
|
||||||
scan.setStopRow(Bytes.toBytes(3));
|
scan.setStopRow(Bytes.toBytes(3));
|
||||||
scan.addColumn(FAMILY, FAMILY);
|
scan.addColumn(FAMILY, FAMILY);
|
||||||
scan.setFilter(new RowFilter(CompareFilter.CompareOp.NOT_EQUAL,
|
scan.setFilter(new RowFilter(CompareOperator.NOT_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes(1))));
|
new BinaryComparator(Bytes.toBytes(1))));
|
||||||
|
|
||||||
ResultScanner scanner = foo.getScanner(scan);
|
ResultScanner scanner = foo.getScanner(scan);
|
||||||
|
@ -5757,7 +5758,7 @@ public class TestFromClientSide {
|
||||||
Scan scan = new Scan();
|
Scan scan = new Scan();
|
||||||
scan.setReversed(true);
|
scan.setReversed(true);
|
||||||
scan.addFamily(FAMILY);
|
scan.addFamily(FAMILY);
|
||||||
Filter filter = new QualifierFilter(CompareOp.EQUAL,
|
Filter filter = new QualifierFilter(CompareOperator.EQUAL,
|
||||||
new RegexStringComparator("col[1-5]"));
|
new RegexStringComparator("col[1-5]"));
|
||||||
scan.setFilter(filter);
|
scan.setFilter(filter);
|
||||||
ResultScanner scanner = ht.getScanner(scan);
|
ResultScanner scanner = ht.getScanner(scan);
|
||||||
|
@ -6561,7 +6562,7 @@ public class TestFromClientSide {
|
||||||
table.put(put);
|
table.put(put);
|
||||||
|
|
||||||
Scan scan =
|
Scan scan =
|
||||||
new Scan().setFilter(new ValueFilter(CompareOp.EQUAL, new SubstringComparator("value-a")))
|
new Scan().setFilter(new ValueFilter(CompareOperator.EQUAL, new SubstringComparator("value-a")))
|
||||||
.setMaxVersions(3);
|
.setMaxVersions(3);
|
||||||
ResultScanner scanner = table.getScanner(scan);
|
ResultScanner scanner = table.getScanner(scan);
|
||||||
Result result = scanner.next();
|
Result result = scanner.next();
|
||||||
|
@ -6571,7 +6572,7 @@ public class TestFromClientSide {
|
||||||
|
|
||||||
Get get =
|
Get get =
|
||||||
new Get(ROW)
|
new Get(ROW)
|
||||||
.setFilter(new ValueFilter(CompareOp.EQUAL, new SubstringComparator("value-a")))
|
.setFilter(new ValueFilter(CompareOperator.EQUAL, new SubstringComparator("value-a")))
|
||||||
.setMaxVersions(3);
|
.setMaxVersions(3);
|
||||||
result = table.get(get);
|
result = table.get(get);
|
||||||
// ts[0] has gone from user view. Only read ts[2] which value is less or equal to 3
|
// ts[0] has gone from user view. Only read ts[2] which value is less or equal to 3
|
||||||
|
@ -6580,7 +6581,7 @@ public class TestFromClientSide {
|
||||||
|
|
||||||
// Test with max versions 1, it should still read ts[1]
|
// Test with max versions 1, it should still read ts[1]
|
||||||
scan =
|
scan =
|
||||||
new Scan().setFilter(new ValueFilter(CompareOp.EQUAL, new SubstringComparator("value-a")))
|
new Scan().setFilter(new ValueFilter(CompareOperator.EQUAL, new SubstringComparator("value-a")))
|
||||||
.setMaxVersions(1);
|
.setMaxVersions(1);
|
||||||
scanner = table.getScanner(scan);
|
scanner = table.getScanner(scan);
|
||||||
result = scanner.next();
|
result = scanner.next();
|
||||||
|
@ -6591,7 +6592,7 @@ public class TestFromClientSide {
|
||||||
// Test with max versions 1, it should still read ts[1]
|
// Test with max versions 1, it should still read ts[1]
|
||||||
get =
|
get =
|
||||||
new Get(ROW)
|
new Get(ROW)
|
||||||
.setFilter(new ValueFilter(CompareOp.EQUAL, new SubstringComparator("value-a")))
|
.setFilter(new ValueFilter(CompareOperator.EQUAL, new SubstringComparator("value-a")))
|
||||||
.setMaxVersions(1);
|
.setMaxVersions(1);
|
||||||
result = table.get(get);
|
result = table.get(get);
|
||||||
// ts[0] has gone from user view. Only read ts[2] which value is less or equal to 3
|
// ts[0] has gone from user view. Only read ts[2] which value is less or equal to 3
|
||||||
|
@ -6600,7 +6601,7 @@ public class TestFromClientSide {
|
||||||
|
|
||||||
// Test with max versions 5, it should still read ts[1]
|
// Test with max versions 5, it should still read ts[1]
|
||||||
scan =
|
scan =
|
||||||
new Scan().setFilter(new ValueFilter(CompareOp.EQUAL, new SubstringComparator("value-a")))
|
new Scan().setFilter(new ValueFilter(CompareOperator.EQUAL, new SubstringComparator("value-a")))
|
||||||
.setMaxVersions(5);
|
.setMaxVersions(5);
|
||||||
scanner = table.getScanner(scan);
|
scanner = table.getScanner(scan);
|
||||||
result = scanner.next();
|
result = scanner.next();
|
||||||
|
@ -6611,7 +6612,7 @@ public class TestFromClientSide {
|
||||||
// Test with max versions 5, it should still read ts[1]
|
// Test with max versions 5, it should still read ts[1]
|
||||||
get =
|
get =
|
||||||
new Get(ROW)
|
new Get(ROW)
|
||||||
.setFilter(new ValueFilter(CompareOp.EQUAL, new SubstringComparator("value-a")))
|
.setFilter(new ValueFilter(CompareOperator.EQUAL, new SubstringComparator("value-a")))
|
||||||
.setMaxVersions(5);
|
.setMaxVersions(5);
|
||||||
result = table.get(get);
|
result = table.get(get);
|
||||||
// ts[0] has gone from user view. Only read ts[2] which value is less or equal to 3
|
// ts[0] has gone from user view. Only read ts[2] which value is less or equal to 3
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.hbase.Cell;
|
import org.apache.hadoop.hbase.Cell;
|
||||||
import org.apache.hadoop.hbase.CellComparator;
|
import org.apache.hadoop.hbase.CellComparator;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||||
import org.apache.hadoop.hbase.HRegionInfo;
|
import org.apache.hadoop.hbase.HRegionInfo;
|
||||||
|
@ -192,7 +193,7 @@ public class TestDependentColumnFilter {
|
||||||
|
|
||||||
// include a comparator operation
|
// include a comparator operation
|
||||||
filter = new DependentColumnFilter(FAMILIES[0], QUALIFIER, false,
|
filter = new DependentColumnFilter(FAMILIES[0], QUALIFIER, false,
|
||||||
CompareOp.EQUAL, new BinaryComparator(MATCH_VAL));
|
CompareOperator.EQUAL, new BinaryComparator(MATCH_VAL));
|
||||||
scan = new Scan();
|
scan = new Scan();
|
||||||
scan.setFilter(filter);
|
scan.setFilter(filter);
|
||||||
scan.setMaxVersions(Integer.MAX_VALUE);
|
scan.setMaxVersions(Integer.MAX_VALUE);
|
||||||
|
@ -209,7 +210,7 @@ public class TestDependentColumnFilter {
|
||||||
|
|
||||||
// include a comparator operation and drop comparator
|
// include a comparator operation and drop comparator
|
||||||
filter = new DependentColumnFilter(FAMILIES[0], QUALIFIER, true,
|
filter = new DependentColumnFilter(FAMILIES[0], QUALIFIER, true,
|
||||||
CompareOp.EQUAL, new BinaryComparator(MATCH_VAL));
|
CompareOperator.EQUAL, new BinaryComparator(MATCH_VAL));
|
||||||
scan = new Scan();
|
scan = new Scan();
|
||||||
scan.setFilter(filter);
|
scan.setFilter(filter);
|
||||||
scan.setMaxVersions(Integer.MAX_VALUE);
|
scan.setMaxVersions(Integer.MAX_VALUE);
|
||||||
|
@ -268,7 +269,7 @@ public class TestDependentColumnFilter {
|
||||||
filter.toString().contains("null"));
|
filter.toString().contains("null"));
|
||||||
|
|
||||||
// Test constructor with explicit null comparator
|
// Test constructor with explicit null comparator
|
||||||
filter = new DependentColumnFilter(FAMILIES[0], QUALIFIER, true, CompareOp.EQUAL, null);
|
filter = new DependentColumnFilter(FAMILIES[0], QUALIFIER, true, CompareOperator.EQUAL, null);
|
||||||
assertNotNull(filter.toString());
|
assertNotNull(filter.toString());
|
||||||
assertTrue("check string contains 'null' as compatator is null",
|
assertTrue("check string contains 'null' as compatator is null",
|
||||||
filter.toString().contains("null"));
|
filter.toString().contains("null"));
|
||||||
|
@ -277,7 +278,7 @@ public class TestDependentColumnFilter {
|
||||||
@Test
|
@Test
|
||||||
public void testToStringWithNonNullComparator() {
|
public void testToStringWithNonNullComparator() {
|
||||||
Filter filter =
|
Filter filter =
|
||||||
new DependentColumnFilter(FAMILIES[0], QUALIFIER, true, CompareOp.EQUAL,
|
new DependentColumnFilter(FAMILIES[0], QUALIFIER, true, CompareOperator.EQUAL,
|
||||||
new BinaryComparator(MATCH_VAL));
|
new BinaryComparator(MATCH_VAL));
|
||||||
assertNotNull(filter.toString());
|
assertNotNull(filter.toString());
|
||||||
assertTrue("check string contains comparator value", filter.toString().contains("match"));
|
assertTrue("check string contains comparator value", filter.toString().contains("match"));
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.hbase.Cell;
|
import org.apache.hadoop.hbase.Cell;
|
||||||
import org.apache.hadoop.hbase.CellComparator;
|
import org.apache.hadoop.hbase.CellComparator;
|
||||||
import org.apache.hadoop.hbase.CellUtil;
|
import org.apache.hadoop.hbase.CellUtil;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||||
import org.apache.hadoop.hbase.HConstants;
|
import org.apache.hadoop.hbase.HConstants;
|
||||||
|
@ -675,7 +676,7 @@ public class TestFilter {
|
||||||
public void testWhileMatchFilterWithFilterKeyValue() throws Exception {
|
public void testWhileMatchFilterWithFilterKeyValue() throws Exception {
|
||||||
Scan s = new Scan();
|
Scan s = new Scan();
|
||||||
WhileMatchFilter filter = new WhileMatchFilter(
|
WhileMatchFilter filter = new WhileMatchFilter(
|
||||||
new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS_ONE[0], CompareOp.EQUAL, Bytes.toBytes("foo"))
|
new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS_ONE[0], CompareOperator.EQUAL, Bytes.toBytes("foo"))
|
||||||
);
|
);
|
||||||
s.setFilter(filter);
|
s.setFilter(filter);
|
||||||
|
|
||||||
|
@ -768,7 +769,7 @@ public class TestFilter {
|
||||||
// Match two keys (one from each family) in half the rows
|
// Match two keys (one from each family) in half the rows
|
||||||
long expectedRows = this.numRows / 2;
|
long expectedRows = this.numRows / 2;
|
||||||
long expectedKeys = 2;
|
long expectedKeys = 2;
|
||||||
Filter f = new QualifierFilter(CompareOp.EQUAL,
|
Filter f = new QualifierFilter(CompareOperator.EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
||||||
Scan s = new Scan();
|
Scan s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -778,7 +779,7 @@ public class TestFilter {
|
||||||
// Expect only two keys (one from each family) in half the rows
|
// Expect only two keys (one from each family) in half the rows
|
||||||
expectedRows = this.numRows / 2;
|
expectedRows = this.numRows / 2;
|
||||||
expectedKeys = 2;
|
expectedKeys = 2;
|
||||||
f = new QualifierFilter(CompareOp.LESS,
|
f = new QualifierFilter(CompareOperator.LESS,
|
||||||
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -788,7 +789,7 @@ public class TestFilter {
|
||||||
// Expect four keys (two from each family) in half the rows
|
// Expect four keys (two from each family) in half the rows
|
||||||
expectedRows = this.numRows / 2;
|
expectedRows = this.numRows / 2;
|
||||||
expectedKeys = 4;
|
expectedKeys = 4;
|
||||||
f = new QualifierFilter(CompareOp.LESS_OR_EQUAL,
|
f = new QualifierFilter(CompareOperator.LESS_OR_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -799,7 +800,7 @@ public class TestFilter {
|
||||||
// Only look in first group of rows
|
// Only look in first group of rows
|
||||||
expectedRows = this.numRows / 2;
|
expectedRows = this.numRows / 2;
|
||||||
expectedKeys = 4;
|
expectedKeys = 4;
|
||||||
f = new QualifierFilter(CompareOp.NOT_EQUAL,
|
f = new QualifierFilter(CompareOperator.NOT_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
||||||
s = new Scan(HConstants.EMPTY_START_ROW, Bytes.toBytes("testRowTwo"));
|
s = new Scan(HConstants.EMPTY_START_ROW, Bytes.toBytes("testRowTwo"));
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -810,7 +811,7 @@ public class TestFilter {
|
||||||
// Only look in first group of rows
|
// Only look in first group of rows
|
||||||
expectedRows = this.numRows / 2;
|
expectedRows = this.numRows / 2;
|
||||||
expectedKeys = 4;
|
expectedKeys = 4;
|
||||||
f = new QualifierFilter(CompareOp.GREATER_OR_EQUAL,
|
f = new QualifierFilter(CompareOperator.GREATER_OR_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
||||||
s = new Scan(HConstants.EMPTY_START_ROW, Bytes.toBytes("testRowTwo"));
|
s = new Scan(HConstants.EMPTY_START_ROW, Bytes.toBytes("testRowTwo"));
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -821,7 +822,7 @@ public class TestFilter {
|
||||||
// Only look in first group of rows
|
// Only look in first group of rows
|
||||||
expectedRows = this.numRows / 2;
|
expectedRows = this.numRows / 2;
|
||||||
expectedKeys = 2;
|
expectedKeys = 2;
|
||||||
f = new QualifierFilter(CompareOp.GREATER,
|
f = new QualifierFilter(CompareOperator.GREATER,
|
||||||
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
new BinaryComparator(Bytes.toBytes("testQualifierOne-2")));
|
||||||
s = new Scan(HConstants.EMPTY_START_ROW, Bytes.toBytes("testRowTwo"));
|
s = new Scan(HConstants.EMPTY_START_ROW, Bytes.toBytes("testRowTwo"));
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -830,7 +831,7 @@ public class TestFilter {
|
||||||
// Match keys not equal to
|
// Match keys not equal to
|
||||||
// Look across rows and fully validate the keys and ordering
|
// Look across rows and fully validate the keys and ordering
|
||||||
// Expect varied numbers of keys, 4 per row in group one, 6 per row in group two
|
// Expect varied numbers of keys, 4 per row in group one, 6 per row in group two
|
||||||
f = new QualifierFilter(CompareOp.NOT_EQUAL,
|
f = new QualifierFilter(CompareOperator.NOT_EQUAL,
|
||||||
new BinaryComparator(QUALIFIERS_ONE[2]));
|
new BinaryComparator(QUALIFIERS_ONE[2]));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -879,7 +880,7 @@ public class TestFilter {
|
||||||
// Test across rows and groups with a regex
|
// Test across rows and groups with a regex
|
||||||
// Filter out "test*-2"
|
// Filter out "test*-2"
|
||||||
// Expect 4 keys per row across both groups
|
// Expect 4 keys per row across both groups
|
||||||
f = new QualifierFilter(CompareOp.NOT_EQUAL,
|
f = new QualifierFilter(CompareOperator.NOT_EQUAL,
|
||||||
new RegexStringComparator("test.+-2"));
|
new RegexStringComparator("test.+-2"));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -926,7 +927,7 @@ public class TestFilter {
|
||||||
// Match family, only half of columns returned.
|
// Match family, only half of columns returned.
|
||||||
long expectedRows = this.numRows;
|
long expectedRows = this.numRows;
|
||||||
long expectedKeys = this.colsPerRow / 2;
|
long expectedKeys = this.colsPerRow / 2;
|
||||||
Filter f = new FamilyFilter(CompareOp.EQUAL,
|
Filter f = new FamilyFilter(CompareOperator.EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testFamilyOne")));
|
new BinaryComparator(Bytes.toBytes("testFamilyOne")));
|
||||||
Scan s = new Scan();
|
Scan s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -935,7 +936,7 @@ public class TestFilter {
|
||||||
// Match keys less than given family, should return nothing
|
// Match keys less than given family, should return nothing
|
||||||
expectedRows = 0;
|
expectedRows = 0;
|
||||||
expectedKeys = 0;
|
expectedKeys = 0;
|
||||||
f = new FamilyFilter(CompareOp.LESS,
|
f = new FamilyFilter(CompareOperator.LESS,
|
||||||
new BinaryComparator(Bytes.toBytes("testFamily")));
|
new BinaryComparator(Bytes.toBytes("testFamily")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -944,7 +945,7 @@ public class TestFilter {
|
||||||
// Match keys less than or equal, should return half of columns
|
// Match keys less than or equal, should return half of columns
|
||||||
expectedRows = this.numRows;
|
expectedRows = this.numRows;
|
||||||
expectedKeys = this.colsPerRow / 2;
|
expectedKeys = this.colsPerRow / 2;
|
||||||
f = new FamilyFilter(CompareOp.LESS_OR_EQUAL,
|
f = new FamilyFilter(CompareOperator.LESS_OR_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testFamilyOne")));
|
new BinaryComparator(Bytes.toBytes("testFamilyOne")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -954,7 +955,7 @@ public class TestFilter {
|
||||||
// look only in second group of rows
|
// look only in second group of rows
|
||||||
expectedRows = this.numRows / 2;
|
expectedRows = this.numRows / 2;
|
||||||
expectedKeys = this.colsPerRow / 2;
|
expectedKeys = this.colsPerRow / 2;
|
||||||
f = new FamilyFilter(CompareOp.NOT_EQUAL,
|
f = new FamilyFilter(CompareOperator.NOT_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testFamilyOne")));
|
new BinaryComparator(Bytes.toBytes("testFamilyOne")));
|
||||||
s = new Scan(HConstants.EMPTY_START_ROW, Bytes.toBytes("testRowTwo"));
|
s = new Scan(HConstants.EMPTY_START_ROW, Bytes.toBytes("testRowTwo"));
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -964,7 +965,7 @@ public class TestFilter {
|
||||||
// look only in second group of rows
|
// look only in second group of rows
|
||||||
expectedRows = this.numRows / 2;
|
expectedRows = this.numRows / 2;
|
||||||
expectedKeys = this.colsPerRow;
|
expectedKeys = this.colsPerRow;
|
||||||
f = new FamilyFilter(CompareOp.GREATER_OR_EQUAL,
|
f = new FamilyFilter(CompareOperator.GREATER_OR_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testFamilyOne")));
|
new BinaryComparator(Bytes.toBytes("testFamilyOne")));
|
||||||
s = new Scan(HConstants.EMPTY_START_ROW, Bytes.toBytes("testRowTwo"));
|
s = new Scan(HConstants.EMPTY_START_ROW, Bytes.toBytes("testRowTwo"));
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -974,7 +975,7 @@ public class TestFilter {
|
||||||
// look only in second group of rows
|
// look only in second group of rows
|
||||||
expectedRows = this.numRows / 2;
|
expectedRows = this.numRows / 2;
|
||||||
expectedKeys = this.colsPerRow / 2;
|
expectedKeys = this.colsPerRow / 2;
|
||||||
f = new FamilyFilter(CompareOp.GREATER,
|
f = new FamilyFilter(CompareOperator.GREATER,
|
||||||
new BinaryComparator(Bytes.toBytes("testFamilyOne")));
|
new BinaryComparator(Bytes.toBytes("testFamilyOne")));
|
||||||
s = new Scan(HConstants.EMPTY_START_ROW, Bytes.toBytes("testRowTwo"));
|
s = new Scan(HConstants.EMPTY_START_ROW, Bytes.toBytes("testRowTwo"));
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -982,7 +983,7 @@ public class TestFilter {
|
||||||
|
|
||||||
// Match keys not equal to given family
|
// Match keys not equal to given family
|
||||||
// Look across rows and fully validate the keys and ordering
|
// Look across rows and fully validate the keys and ordering
|
||||||
f = new FamilyFilter(CompareOp.NOT_EQUAL,
|
f = new FamilyFilter(CompareOperator.NOT_EQUAL,
|
||||||
new BinaryComparator(FAMILIES[1]));
|
new BinaryComparator(FAMILIES[1]));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1019,7 +1020,7 @@ public class TestFilter {
|
||||||
// Test across rows and groups with a regex
|
// Test across rows and groups with a regex
|
||||||
// Filter out "test*-2"
|
// Filter out "test*-2"
|
||||||
// Expect 4 keys per row across both groups
|
// Expect 4 keys per row across both groups
|
||||||
f = new FamilyFilter(CompareOp.NOT_EQUAL,
|
f = new FamilyFilter(CompareOperator.NOT_EQUAL,
|
||||||
new RegexStringComparator("test.*One"));
|
new RegexStringComparator("test.*One"));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1061,7 +1062,7 @@ public class TestFilter {
|
||||||
// Match a single row, all keys
|
// Match a single row, all keys
|
||||||
long expectedRows = 1;
|
long expectedRows = 1;
|
||||||
long expectedKeys = this.colsPerRow;
|
long expectedKeys = this.colsPerRow;
|
||||||
Filter f = new RowFilter(CompareOp.EQUAL,
|
Filter f = new RowFilter(CompareOperator.EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
||||||
Scan s = new Scan();
|
Scan s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1070,7 +1071,7 @@ public class TestFilter {
|
||||||
// Match a two rows, one from each group, using regex
|
// Match a two rows, one from each group, using regex
|
||||||
expectedRows = 2;
|
expectedRows = 2;
|
||||||
expectedKeys = this.colsPerRow;
|
expectedKeys = this.colsPerRow;
|
||||||
f = new RowFilter(CompareOp.EQUAL,
|
f = new RowFilter(CompareOperator.EQUAL,
|
||||||
new RegexStringComparator("testRow.+-2"));
|
new RegexStringComparator("testRow.+-2"));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1080,7 +1081,7 @@ public class TestFilter {
|
||||||
// Expect all keys in one row
|
// Expect all keys in one row
|
||||||
expectedRows = 1;
|
expectedRows = 1;
|
||||||
expectedKeys = this.colsPerRow;
|
expectedKeys = this.colsPerRow;
|
||||||
f = new RowFilter(CompareOp.LESS,
|
f = new RowFilter(CompareOperator.LESS,
|
||||||
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1090,7 +1091,7 @@ public class TestFilter {
|
||||||
// Expect all keys in two rows
|
// Expect all keys in two rows
|
||||||
expectedRows = 2;
|
expectedRows = 2;
|
||||||
expectedKeys = this.colsPerRow;
|
expectedKeys = this.colsPerRow;
|
||||||
f = new RowFilter(CompareOp.LESS_OR_EQUAL,
|
f = new RowFilter(CompareOperator.LESS_OR_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1100,7 +1101,7 @@ public class TestFilter {
|
||||||
// Expect all keys in all but one row
|
// Expect all keys in all but one row
|
||||||
expectedRows = this.numRows - 1;
|
expectedRows = this.numRows - 1;
|
||||||
expectedKeys = this.colsPerRow;
|
expectedKeys = this.colsPerRow;
|
||||||
f = new RowFilter(CompareOp.NOT_EQUAL,
|
f = new RowFilter(CompareOperator.NOT_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1110,7 +1111,7 @@ public class TestFilter {
|
||||||
// Expect all keys in all but one row
|
// Expect all keys in all but one row
|
||||||
expectedRows = this.numRows - 1;
|
expectedRows = this.numRows - 1;
|
||||||
expectedKeys = this.colsPerRow;
|
expectedKeys = this.colsPerRow;
|
||||||
f = new RowFilter(CompareOp.GREATER_OR_EQUAL,
|
f = new RowFilter(CompareOperator.GREATER_OR_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1120,7 +1121,7 @@ public class TestFilter {
|
||||||
// Expect all keys in all but two rows
|
// Expect all keys in all but two rows
|
||||||
expectedRows = this.numRows - 2;
|
expectedRows = this.numRows - 2;
|
||||||
expectedKeys = this.colsPerRow;
|
expectedKeys = this.colsPerRow;
|
||||||
f = new RowFilter(CompareOp.GREATER,
|
f = new RowFilter(CompareOperator.GREATER,
|
||||||
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1129,7 +1130,7 @@ public class TestFilter {
|
||||||
// Match rows not equal to testRowTwo-2
|
// Match rows not equal to testRowTwo-2
|
||||||
// Look across rows and fully validate the keys and ordering
|
// Look across rows and fully validate the keys and ordering
|
||||||
// Should see all keys in all rows but testRowTwo-2
|
// Should see all keys in all rows but testRowTwo-2
|
||||||
f = new RowFilter(CompareOp.NOT_EQUAL,
|
f = new RowFilter(CompareOperator.NOT_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
new BinaryComparator(Bytes.toBytes("testRowOne-2")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1177,7 +1178,7 @@ public class TestFilter {
|
||||||
// Test across rows and groups with a regex
|
// Test across rows and groups with a regex
|
||||||
// Filter out everything that doesn't match "*-2"
|
// Filter out everything that doesn't match "*-2"
|
||||||
// Expect all keys in two rows
|
// Expect all keys in two rows
|
||||||
f = new RowFilter(CompareOp.EQUAL,
|
f = new RowFilter(CompareOperator.EQUAL,
|
||||||
new RegexStringComparator(".+-2"));
|
new RegexStringComparator(".+-2"));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1208,7 +1209,7 @@ public class TestFilter {
|
||||||
// Match group one rows
|
// Match group one rows
|
||||||
long expectedRows = this.numRows / 2;
|
long expectedRows = this.numRows / 2;
|
||||||
long expectedKeys = this.colsPerRow;
|
long expectedKeys = this.colsPerRow;
|
||||||
Filter f = new ValueFilter(CompareOp.EQUAL,
|
Filter f = new ValueFilter(CompareOperator.EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
||||||
Scan s = new Scan();
|
Scan s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1217,7 +1218,7 @@ public class TestFilter {
|
||||||
// Match group two rows
|
// Match group two rows
|
||||||
expectedRows = this.numRows / 2;
|
expectedRows = this.numRows / 2;
|
||||||
expectedKeys = this.colsPerRow;
|
expectedKeys = this.colsPerRow;
|
||||||
f = new ValueFilter(CompareOp.EQUAL,
|
f = new ValueFilter(CompareOperator.EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testValueTwo")));
|
new BinaryComparator(Bytes.toBytes("testValueTwo")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1226,7 +1227,7 @@ public class TestFilter {
|
||||||
// Match all values using regex
|
// Match all values using regex
|
||||||
expectedRows = this.numRows;
|
expectedRows = this.numRows;
|
||||||
expectedKeys = this.colsPerRow;
|
expectedKeys = this.colsPerRow;
|
||||||
f = new ValueFilter(CompareOp.EQUAL,
|
f = new ValueFilter(CompareOperator.EQUAL,
|
||||||
new RegexStringComparator("testValue((One)|(Two))"));
|
new RegexStringComparator("testValue((One)|(Two))"));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1236,7 +1237,7 @@ public class TestFilter {
|
||||||
// Expect group one rows
|
// Expect group one rows
|
||||||
expectedRows = this.numRows / 2;
|
expectedRows = this.numRows / 2;
|
||||||
expectedKeys = this.colsPerRow;
|
expectedKeys = this.colsPerRow;
|
||||||
f = new ValueFilter(CompareOp.LESS,
|
f = new ValueFilter(CompareOperator.LESS,
|
||||||
new BinaryComparator(Bytes.toBytes("testValueTwo")));
|
new BinaryComparator(Bytes.toBytes("testValueTwo")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1246,7 +1247,7 @@ public class TestFilter {
|
||||||
// Expect all rows
|
// Expect all rows
|
||||||
expectedRows = this.numRows;
|
expectedRows = this.numRows;
|
||||||
expectedKeys = this.colsPerRow;
|
expectedKeys = this.colsPerRow;
|
||||||
f = new ValueFilter(CompareOp.LESS_OR_EQUAL,
|
f = new ValueFilter(CompareOperator.LESS_OR_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testValueTwo")));
|
new BinaryComparator(Bytes.toBytes("testValueTwo")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1256,7 +1257,7 @@ public class TestFilter {
|
||||||
// Expect group one rows
|
// Expect group one rows
|
||||||
expectedRows = this.numRows / 2;
|
expectedRows = this.numRows / 2;
|
||||||
expectedKeys = this.colsPerRow;
|
expectedKeys = this.colsPerRow;
|
||||||
f = new ValueFilter(CompareOp.LESS_OR_EQUAL,
|
f = new ValueFilter(CompareOperator.LESS_OR_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1266,7 +1267,7 @@ public class TestFilter {
|
||||||
// Expect half the rows
|
// Expect half the rows
|
||||||
expectedRows = this.numRows / 2;
|
expectedRows = this.numRows / 2;
|
||||||
expectedKeys = this.colsPerRow;
|
expectedKeys = this.colsPerRow;
|
||||||
f = new ValueFilter(CompareOp.NOT_EQUAL,
|
f = new ValueFilter(CompareOperator.NOT_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1276,7 +1277,7 @@ public class TestFilter {
|
||||||
// Expect all rows
|
// Expect all rows
|
||||||
expectedRows = this.numRows;
|
expectedRows = this.numRows;
|
||||||
expectedKeys = this.colsPerRow;
|
expectedKeys = this.colsPerRow;
|
||||||
f = new ValueFilter(CompareOp.GREATER_OR_EQUAL,
|
f = new ValueFilter(CompareOperator.GREATER_OR_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1286,7 +1287,7 @@ public class TestFilter {
|
||||||
// Expect half rows
|
// Expect half rows
|
||||||
expectedRows = this.numRows / 2;
|
expectedRows = this.numRows / 2;
|
||||||
expectedKeys = this.colsPerRow;
|
expectedKeys = this.colsPerRow;
|
||||||
f = new ValueFilter(CompareOp.GREATER,
|
f = new ValueFilter(CompareOperator.GREATER,
|
||||||
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1295,7 +1296,7 @@ public class TestFilter {
|
||||||
// Match values not equal to testValueOne
|
// Match values not equal to testValueOne
|
||||||
// Look across rows and fully validate the keys and ordering
|
// Look across rows and fully validate the keys and ordering
|
||||||
// Should see all keys in all group two rows
|
// Should see all keys in all group two rows
|
||||||
f = new ValueFilter(CompareOp.NOT_EQUAL,
|
f = new ValueFilter(CompareOperator.NOT_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1331,7 +1332,7 @@ public class TestFilter {
|
||||||
|
|
||||||
// Test for qualifier regex: "testQualifierOne-2"
|
// Test for qualifier regex: "testQualifierOne-2"
|
||||||
// Should only get rows from second group, and all keys
|
// Should only get rows from second group, and all keys
|
||||||
Filter f = new SkipFilter(new QualifierFilter(CompareOp.NOT_EQUAL,
|
Filter f = new SkipFilter(new QualifierFilter(CompareOperator.NOT_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("testQualifierOne-2"))));
|
new BinaryComparator(Bytes.toBytes("testQualifierOne-2"))));
|
||||||
Scan s = new Scan();
|
Scan s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1371,9 +1372,9 @@ public class TestFilter {
|
||||||
// regular expression and substring filters
|
// regular expression and substring filters
|
||||||
// Use must pass all
|
// Use must pass all
|
||||||
List<Filter> filters = new ArrayList<>();
|
List<Filter> filters = new ArrayList<>();
|
||||||
filters.add(new RowFilter(CompareOp.EQUAL, new RegexStringComparator(".+-2")));
|
filters.add(new RowFilter(CompareOperator.EQUAL, new RegexStringComparator(".+-2")));
|
||||||
filters.add(new QualifierFilter(CompareOp.EQUAL, new RegexStringComparator(".+-2")));
|
filters.add(new QualifierFilter(CompareOperator.EQUAL, new RegexStringComparator(".+-2")));
|
||||||
filters.add(new ValueFilter(CompareOp.EQUAL, new SubstringComparator("One")));
|
filters.add(new ValueFilter(CompareOperator.EQUAL, new SubstringComparator("One")));
|
||||||
Filter f = new FilterList(Operator.MUST_PASS_ALL, filters);
|
Filter f = new FilterList(Operator.MUST_PASS_ALL, filters);
|
||||||
Scan s = new Scan();
|
Scan s = new Scan();
|
||||||
s.addFamily(FAMILIES[0]);
|
s.addFamily(FAMILIES[0]);
|
||||||
|
@ -1386,9 +1387,9 @@ public class TestFilter {
|
||||||
// Test getting everything with a MUST_PASS_ONE filter including row, qf, val
|
// Test getting everything with a MUST_PASS_ONE filter including row, qf, val
|
||||||
// regular expression and substring filters
|
// regular expression and substring filters
|
||||||
filters.clear();
|
filters.clear();
|
||||||
filters.add(new RowFilter(CompareOp.EQUAL, new RegexStringComparator(".+Two.+")));
|
filters.add(new RowFilter(CompareOperator.EQUAL, new RegexStringComparator(".+Two.+")));
|
||||||
filters.add(new QualifierFilter(CompareOp.EQUAL, new RegexStringComparator(".+-2")));
|
filters.add(new QualifierFilter(CompareOperator.EQUAL, new RegexStringComparator(".+-2")));
|
||||||
filters.add(new ValueFilter(CompareOp.EQUAL, new SubstringComparator("One")));
|
filters.add(new ValueFilter(CompareOperator.EQUAL, new SubstringComparator("One")));
|
||||||
f = new FilterList(Operator.MUST_PASS_ONE, filters);
|
f = new FilterList(Operator.MUST_PASS_ONE, filters);
|
||||||
s = new Scan();
|
s = new Scan();
|
||||||
s.setFilter(f);
|
s.setFilter(f);
|
||||||
|
@ -1419,7 +1420,7 @@ public class TestFilter {
|
||||||
|
|
||||||
// Scan using SingleColumnValueFilter
|
// Scan using SingleColumnValueFilter
|
||||||
SingleColumnValueFilter f1 = new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS_ONE[0],
|
SingleColumnValueFilter f1 = new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS_ONE[0],
|
||||||
CompareOp.EQUAL, VALUES[0]);
|
CompareOperator.EQUAL, VALUES[0]);
|
||||||
f1.setFilterIfMissing( true );
|
f1.setFilterIfMissing( true );
|
||||||
Scan s1 = new Scan();
|
Scan s1 = new Scan();
|
||||||
s1.addFamily(FAMILIES[0]);
|
s1.addFamily(FAMILIES[0]);
|
||||||
|
@ -1440,7 +1441,7 @@ public class TestFilter {
|
||||||
|
|
||||||
// Scan using another SingleColumnValueFilter, expect disjoint result
|
// Scan using another SingleColumnValueFilter, expect disjoint result
|
||||||
SingleColumnValueFilter f2 = new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS_TWO[0],
|
SingleColumnValueFilter f2 = new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS_TWO[0],
|
||||||
CompareOp.EQUAL, VALUES[1]);
|
CompareOperator.EQUAL, VALUES[1]);
|
||||||
f2.setFilterIfMissing( true );
|
f2.setFilterIfMissing( true );
|
||||||
Scan s2 = new Scan();
|
Scan s2 = new Scan();
|
||||||
s2.addFamily(FAMILIES[0]);
|
s2.addFamily(FAMILIES[0]);
|
||||||
|
@ -1513,7 +1514,7 @@ public class TestFilter {
|
||||||
PrefixFilter pf = new PrefixFilter(new byte[] {'b'}) ;
|
PrefixFilter pf = new PrefixFilter(new byte[] {'b'}) ;
|
||||||
// rows with value of column 'q1' set to '113'
|
// rows with value of column 'q1' set to '113'
|
||||||
SingleColumnValueFilter scvf = new SingleColumnValueFilter(
|
SingleColumnValueFilter scvf = new SingleColumnValueFilter(
|
||||||
family, qualifier, CompareOp.EQUAL, Bytes.toBytes("113"));
|
family, qualifier, CompareOperator.EQUAL, Bytes.toBytes("113"));
|
||||||
// combine these two with OR in a FilterList
|
// combine these two with OR in a FilterList
|
||||||
FilterList filterList = new FilterList(Operator.MUST_PASS_ONE, pf, scvf);
|
FilterList filterList = new FilterList(Operator.MUST_PASS_ONE, pf, scvf);
|
||||||
|
|
||||||
|
@ -1555,9 +1556,9 @@ public class TestFilter {
|
||||||
// so limiting scan to group one
|
// so limiting scan to group one
|
||||||
List<Filter> filters = new ArrayList<>();
|
List<Filter> filters = new ArrayList<>();
|
||||||
filters.add(new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS_ONE[0],
|
filters.add(new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS_ONE[0],
|
||||||
CompareOp.EQUAL, VALUES[0]));
|
CompareOperator.EQUAL, VALUES[0]));
|
||||||
filters.add(new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS_ONE[2],
|
filters.add(new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS_ONE[2],
|
||||||
CompareOp.EQUAL, VALUES[1]));
|
CompareOperator.EQUAL, VALUES[1]));
|
||||||
Filter f = new FilterList(Operator.MUST_PASS_ALL, filters);
|
Filter f = new FilterList(Operator.MUST_PASS_ALL, filters);
|
||||||
Scan s = new Scan(ROWS_ONE[0], ROWS_TWO[0]);
|
Scan s = new Scan(ROWS_ONE[0], ROWS_TWO[0]);
|
||||||
s.addFamily(FAMILIES[0]);
|
s.addFamily(FAMILIES[0]);
|
||||||
|
@ -1575,9 +1576,9 @@ public class TestFilter {
|
||||||
// need to wrap SCVFs in SkipFilters
|
// need to wrap SCVFs in SkipFilters
|
||||||
filters = new ArrayList<>();
|
filters = new ArrayList<>();
|
||||||
filters.add(new SkipFilter(new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS_ONE[0],
|
filters.add(new SkipFilter(new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS_ONE[0],
|
||||||
CompareOp.EQUAL, VALUES[0])));
|
CompareOperator.EQUAL, VALUES[0])));
|
||||||
filters.add(new SkipFilter(new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS_ONE[2],
|
filters.add(new SkipFilter(new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS_ONE[2],
|
||||||
CompareOp.EQUAL, VALUES[1])));
|
CompareOperator.EQUAL, VALUES[1])));
|
||||||
f = new FilterList(Operator.MUST_PASS_ALL, filters);
|
f = new FilterList(Operator.MUST_PASS_ALL, filters);
|
||||||
s = new Scan(ROWS_ONE[0], ROWS_TWO[0]);
|
s = new Scan(ROWS_ONE[0], ROWS_TWO[0]);
|
||||||
s.addFamily(FAMILIES[0]);
|
s.addFamily(FAMILIES[0]);
|
||||||
|
@ -1612,7 +1613,7 @@ public class TestFilter {
|
||||||
// Match VALUES[0] against QUALIFIERS_ONE[0] with filterIfMissing = false
|
// Match VALUES[0] against QUALIFIERS_ONE[0] with filterIfMissing = false
|
||||||
// Expect 3 rows (0, 2, 3)
|
// Expect 3 rows (0, 2, 3)
|
||||||
SingleColumnValueFilter scvf = new SingleColumnValueFilter(FAMILIES[0],
|
SingleColumnValueFilter scvf = new SingleColumnValueFilter(FAMILIES[0],
|
||||||
QUALIFIERS_ONE[0], CompareOp.EQUAL, VALUES[0]);
|
QUALIFIERS_ONE[0], CompareOperator.EQUAL, VALUES[0]);
|
||||||
s = new Scan(ROWS_THREE[0], Bytes.toBytes("rowThree-4"));
|
s = new Scan(ROWS_THREE[0], Bytes.toBytes("rowThree-4"));
|
||||||
s.addFamily(FAMILIES[0]);
|
s.addFamily(FAMILIES[0]);
|
||||||
s.setFilter(scvf);
|
s.setFilter(scvf);
|
||||||
|
@ -1622,7 +1623,7 @@ public class TestFilter {
|
||||||
// Match VALUES[0] against QUALIFIERS_ONE[0] with filterIfMissing = true
|
// Match VALUES[0] against QUALIFIERS_ONE[0] with filterIfMissing = true
|
||||||
// Expect 1 row (0)
|
// Expect 1 row (0)
|
||||||
scvf = new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS_ONE[0],
|
scvf = new SingleColumnValueFilter(FAMILIES[0], QUALIFIERS_ONE[0],
|
||||||
CompareOp.EQUAL, VALUES[0]);
|
CompareOperator.EQUAL, VALUES[0]);
|
||||||
scvf.setFilterIfMissing(true);
|
scvf.setFilterIfMissing(true);
|
||||||
s = new Scan(ROWS_THREE[0], Bytes.toBytes("rowThree-4"));
|
s = new Scan(ROWS_THREE[0], Bytes.toBytes("rowThree-4"));
|
||||||
s.addFamily(FAMILIES[0]);
|
s.addFamily(FAMILIES[0]);
|
||||||
|
@ -1633,7 +1634,7 @@ public class TestFilter {
|
||||||
// Match VALUES[1] against QUALIFIERS_ONE[1] with filterIfMissing = true
|
// Match VALUES[1] against QUALIFIERS_ONE[1] with filterIfMissing = true
|
||||||
// Expect 1 row (3)
|
// Expect 1 row (3)
|
||||||
scvf = new SingleColumnValueFilter(FAMILIES[0],
|
scvf = new SingleColumnValueFilter(FAMILIES[0],
|
||||||
QUALIFIERS_ONE[1], CompareOp.EQUAL, VALUES[1]);
|
QUALIFIERS_ONE[1], CompareOperator.EQUAL, VALUES[1]);
|
||||||
scvf.setFilterIfMissing(true);
|
scvf.setFilterIfMissing(true);
|
||||||
s = new Scan(ROWS_THREE[0], Bytes.toBytes("rowThree-4"));
|
s = new Scan(ROWS_THREE[0], Bytes.toBytes("rowThree-4"));
|
||||||
s.addFamily(FAMILIES[0]);
|
s.addFamily(FAMILIES[0]);
|
||||||
|
@ -1648,7 +1649,7 @@ public class TestFilter {
|
||||||
// Match VALUES[1] against QUALIFIERS_ONE[1] with filterIfMissing = true
|
// Match VALUES[1] against QUALIFIERS_ONE[1] with filterIfMissing = true
|
||||||
// Expect 1 row (3)
|
// Expect 1 row (3)
|
||||||
scvf = new SingleColumnValueFilter(FAMILIES[0],
|
scvf = new SingleColumnValueFilter(FAMILIES[0],
|
||||||
QUALIFIERS_ONE[1], CompareOp.EQUAL, VALUES[1]);
|
QUALIFIERS_ONE[1], CompareOperator.EQUAL, VALUES[1]);
|
||||||
scvf.setFilterIfMissing(true);
|
scvf.setFilterIfMissing(true);
|
||||||
s = new Scan(ROWS_THREE[0], Bytes.toBytes("rowThree-4"));
|
s = new Scan(ROWS_THREE[0], Bytes.toBytes("rowThree-4"));
|
||||||
s.addFamily(FAMILIES[0]);
|
s.addFamily(FAMILIES[0]);
|
||||||
|
@ -2069,7 +2070,7 @@ public class TestFilter {
|
||||||
}
|
}
|
||||||
testRegion.flush(true);
|
testRegion.flush(true);
|
||||||
// 1. got rows > "row4"
|
// 1. got rows > "row4"
|
||||||
Filter rowFilter = new RowFilter(CompareOp.GREATER,new BinaryComparator(Bytes.toBytes("row4")));
|
Filter rowFilter = new RowFilter(CompareOperator.GREATER,new BinaryComparator(Bytes.toBytes("row4")));
|
||||||
Scan s1 = new Scan();
|
Scan s1 = new Scan();
|
||||||
s1.setFilter(rowFilter);
|
s1.setFilter(rowFilter);
|
||||||
InternalScanner scanner = testRegion.getScanner(s1);
|
InternalScanner scanner = testRegion.getScanner(s1);
|
||||||
|
@ -2083,10 +2084,10 @@ public class TestFilter {
|
||||||
}
|
}
|
||||||
// 2. got rows <= "row4" and S=
|
// 2. got rows <= "row4" and S=
|
||||||
FilterList subFilterList = new FilterList(FilterList.Operator.MUST_PASS_ALL);
|
FilterList subFilterList = new FilterList(FilterList.Operator.MUST_PASS_ALL);
|
||||||
Filter subFilter1 = new RowFilter(CompareOp.LESS_OR_EQUAL,
|
Filter subFilter1 = new RowFilter(CompareOperator.LESS_OR_EQUAL,
|
||||||
new BinaryComparator(Bytes.toBytes("row4")));
|
new BinaryComparator(Bytes.toBytes("row4")));
|
||||||
subFilterList.addFilter(subFilter1);
|
subFilterList.addFilter(subFilter1);
|
||||||
Filter subFilter2 = new SingleColumnValueFilter(FAMILIES[0], columnStatus, CompareOp.EQUAL,
|
Filter subFilter2 = new SingleColumnValueFilter(FAMILIES[0], columnStatus, CompareOperator.EQUAL,
|
||||||
Bytes.toBytes(0));
|
Bytes.toBytes(0));
|
||||||
subFilterList.addFilter(subFilter2);
|
subFilterList.addFilter(subFilter2);
|
||||||
s1 = new Scan();
|
s1 = new Scan();
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.hbase.filter;
|
package org.apache.hadoop.hbase.filter;
|
||||||
|
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
|
import org.apache.hadoop.hbase.shaded.com.google.common.collect.Lists;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -565,12 +566,12 @@ public class TestFilterList {
|
||||||
// OR (family=fam AND qualifier=qual2)
|
// OR (family=fam AND qualifier=qual2)
|
||||||
final FilterList flist = new FilterList(Operator.MUST_PASS_ONE, Lists.<Filter>newArrayList(
|
final FilterList flist = new FilterList(Operator.MUST_PASS_ONE, Lists.<Filter>newArrayList(
|
||||||
new FilterList(Operator.MUST_PASS_ALL, Lists.<Filter>newArrayList(
|
new FilterList(Operator.MUST_PASS_ALL, Lists.<Filter>newArrayList(
|
||||||
new FamilyFilter(CompareOp.EQUAL, new BinaryComparator(Bytes.toBytes("fam"))),
|
new FamilyFilter(CompareOperator.EQUAL, new BinaryComparator(Bytes.toBytes("fam"))),
|
||||||
new QualifierFilter(CompareOp.EQUAL, new BinaryComparator(Bytes.toBytes("qual1"))),
|
new QualifierFilter(CompareOperator.EQUAL, new BinaryComparator(Bytes.toBytes("qual1"))),
|
||||||
new KeyOnlyFilter())),
|
new KeyOnlyFilter())),
|
||||||
new FilterList(Operator.MUST_PASS_ALL, Lists.<Filter>newArrayList(
|
new FilterList(Operator.MUST_PASS_ALL, Lists.<Filter>newArrayList(
|
||||||
new FamilyFilter(CompareOp.EQUAL, new BinaryComparator(Bytes.toBytes("fam"))),
|
new FamilyFilter(CompareOperator.EQUAL, new BinaryComparator(Bytes.toBytes("fam"))),
|
||||||
new QualifierFilter(CompareOp.EQUAL, new BinaryComparator(Bytes.toBytes("qual2")))))));
|
new QualifierFilter(CompareOperator.EQUAL, new BinaryComparator(Bytes.toBytes("qual2")))))));
|
||||||
|
|
||||||
final KeyValue kvQual1 = new KeyValue(
|
final KeyValue kvQual1 = new KeyValue(
|
||||||
Bytes.toBytes("row"), Bytes.toBytes("fam"), Bytes.toBytes("qual1"), Bytes.toBytes("value"));
|
Bytes.toBytes("row"), Bytes.toBytes("fam"), Bytes.toBytes("qual1"), Bytes.toBytes("value"));
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.testclassification.FilterTests;
|
import org.apache.hadoop.hbase.testclassification.FilterTests;
|
||||||
import org.apache.hadoop.hbase.testclassification.SmallTests;
|
import org.apache.hadoop.hbase.testclassification.SmallTests;
|
||||||
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
|
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
|
||||||
|
@ -88,7 +89,7 @@ public class TestFilterSerialization {
|
||||||
|
|
||||||
// non-null column qualifier/family
|
// non-null column qualifier/family
|
||||||
dependentColumnFilter = new DependentColumnFilter(Bytes.toBytes("family"),
|
dependentColumnFilter = new DependentColumnFilter(Bytes.toBytes("family"),
|
||||||
Bytes.toBytes("qual"), true, CompareOp.GREATER_OR_EQUAL,
|
Bytes.toBytes("qual"), true, CompareOperator.GREATER_OR_EQUAL,
|
||||||
new BitComparator(Bytes.toBytes("bitComparator"), BitComparator.BitwiseOp.OR));
|
new BitComparator(Bytes.toBytes("bitComparator"), BitComparator.BitwiseOp.OR));
|
||||||
assertTrue(dependentColumnFilter.areSerializedFieldsEqual(
|
assertTrue(dependentColumnFilter.areSerializedFieldsEqual(
|
||||||
ProtobufUtil.toFilter(ProtobufUtil.toFilter(dependentColumnFilter))));
|
ProtobufUtil.toFilter(ProtobufUtil.toFilter(dependentColumnFilter))));
|
||||||
|
@ -96,7 +97,7 @@ public class TestFilterSerialization {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFamilyFilter() throws Exception {
|
public void testFamilyFilter() throws Exception {
|
||||||
FamilyFilter familyFilter = new FamilyFilter(CompareFilter.CompareOp.EQUAL,
|
FamilyFilter familyFilter = new FamilyFilter(CompareOperator.EQUAL,
|
||||||
new BinaryPrefixComparator(Bytes.toBytes("testValueOne")));
|
new BinaryPrefixComparator(Bytes.toBytes("testValueOne")));
|
||||||
assertTrue(familyFilter.areSerializedFieldsEqual(
|
assertTrue(familyFilter.areSerializedFieldsEqual(
|
||||||
ProtobufUtil.toFilter(ProtobufUtil.toFilter(familyFilter))));
|
ProtobufUtil.toFilter(ProtobufUtil.toFilter(familyFilter))));
|
||||||
|
@ -112,7 +113,7 @@ public class TestFilterSerialization {
|
||||||
// non-empty filter list
|
// non-empty filter list
|
||||||
LinkedList<Filter> list = new LinkedList<>();
|
LinkedList<Filter> list = new LinkedList<>();
|
||||||
list.add(new ColumnCountGetFilter(1));
|
list.add(new ColumnCountGetFilter(1));
|
||||||
list.add(new RowFilter(CompareFilter.CompareOp.EQUAL,
|
list.add(new RowFilter(CompareOperator.EQUAL,
|
||||||
new SubstringComparator("testFilterList")));
|
new SubstringComparator("testFilterList")));
|
||||||
assertTrue(filterList.areSerializedFieldsEqual(
|
assertTrue(filterList.areSerializedFieldsEqual(
|
||||||
ProtobufUtil.toFilter(ProtobufUtil.toFilter(filterList))));
|
ProtobufUtil.toFilter(ProtobufUtil.toFilter(filterList))));
|
||||||
|
@ -229,7 +230,7 @@ public class TestFilterSerialization {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQualifierFilter() throws Exception {
|
public void testQualifierFilter() throws Exception {
|
||||||
QualifierFilter qualifierFilter = new QualifierFilter(CompareFilter.CompareOp.EQUAL,
|
QualifierFilter qualifierFilter = new QualifierFilter(CompareOperator.EQUAL,
|
||||||
new NullComparator());
|
new NullComparator());
|
||||||
assertTrue(qualifierFilter.areSerializedFieldsEqual(
|
assertTrue(qualifierFilter.areSerializedFieldsEqual(
|
||||||
ProtobufUtil.toFilter(ProtobufUtil.toFilter(qualifierFilter))));
|
ProtobufUtil.toFilter(ProtobufUtil.toFilter(qualifierFilter))));
|
||||||
|
@ -244,7 +245,7 @@ public class TestFilterSerialization {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRowFilter() throws Exception {
|
public void testRowFilter() throws Exception {
|
||||||
RowFilter rowFilter = new RowFilter(CompareFilter.CompareOp.EQUAL,
|
RowFilter rowFilter = new RowFilter(CompareOperator.EQUAL,
|
||||||
new SubstringComparator("testRowFilter"));
|
new SubstringComparator("testRowFilter"));
|
||||||
assertTrue(rowFilter.areSerializedFieldsEqual(
|
assertTrue(rowFilter.areSerializedFieldsEqual(
|
||||||
ProtobufUtil.toFilter(ProtobufUtil.toFilter(rowFilter))));
|
ProtobufUtil.toFilter(ProtobufUtil.toFilter(rowFilter))));
|
||||||
|
@ -255,14 +256,14 @@ public class TestFilterSerialization {
|
||||||
// null family/column SingleColumnValueExcludeFilter
|
// null family/column SingleColumnValueExcludeFilter
|
||||||
SingleColumnValueExcludeFilter singleColumnValueExcludeFilter =
|
SingleColumnValueExcludeFilter singleColumnValueExcludeFilter =
|
||||||
new SingleColumnValueExcludeFilter(null, null,
|
new SingleColumnValueExcludeFilter(null, null,
|
||||||
CompareFilter.CompareOp.GREATER_OR_EQUAL, Bytes.toBytes("value"));
|
CompareOperator.GREATER_OR_EQUAL, Bytes.toBytes("value"));
|
||||||
assertTrue(singleColumnValueExcludeFilter.areSerializedFieldsEqual(
|
assertTrue(singleColumnValueExcludeFilter.areSerializedFieldsEqual(
|
||||||
ProtobufUtil.toFilter(ProtobufUtil.toFilter(singleColumnValueExcludeFilter))));
|
ProtobufUtil.toFilter(ProtobufUtil.toFilter(singleColumnValueExcludeFilter))));
|
||||||
|
|
||||||
// non-null family/column SingleColumnValueFilter
|
// non-null family/column SingleColumnValueFilter
|
||||||
singleColumnValueExcludeFilter =
|
singleColumnValueExcludeFilter =
|
||||||
new SingleColumnValueExcludeFilter(Bytes.toBytes("fam"), Bytes.toBytes("qual"),
|
new SingleColumnValueExcludeFilter(Bytes.toBytes("fam"), Bytes.toBytes("qual"),
|
||||||
CompareFilter.CompareOp.LESS_OR_EQUAL, new NullComparator(), false, false);
|
CompareOperator.LESS_OR_EQUAL, new NullComparator(), false, false);
|
||||||
assertTrue(singleColumnValueExcludeFilter.areSerializedFieldsEqual(
|
assertTrue(singleColumnValueExcludeFilter.areSerializedFieldsEqual(
|
||||||
ProtobufUtil.toFilter(ProtobufUtil.toFilter(singleColumnValueExcludeFilter))));
|
ProtobufUtil.toFilter(ProtobufUtil.toFilter(singleColumnValueExcludeFilter))));
|
||||||
}
|
}
|
||||||
|
@ -272,14 +273,14 @@ public class TestFilterSerialization {
|
||||||
// null family/column SingleColumnValueFilter
|
// null family/column SingleColumnValueFilter
|
||||||
SingleColumnValueFilter singleColumnValueFilter =
|
SingleColumnValueFilter singleColumnValueFilter =
|
||||||
new SingleColumnValueFilter(null, null,
|
new SingleColumnValueFilter(null, null,
|
||||||
CompareFilter.CompareOp.LESS, Bytes.toBytes("value"));
|
CompareOperator.LESS, Bytes.toBytes("value"));
|
||||||
assertTrue(singleColumnValueFilter.areSerializedFieldsEqual(
|
assertTrue(singleColumnValueFilter.areSerializedFieldsEqual(
|
||||||
ProtobufUtil.toFilter(ProtobufUtil.toFilter(singleColumnValueFilter))));
|
ProtobufUtil.toFilter(ProtobufUtil.toFilter(singleColumnValueFilter))));
|
||||||
|
|
||||||
// non-null family/column SingleColumnValueFilter
|
// non-null family/column SingleColumnValueFilter
|
||||||
singleColumnValueFilter =
|
singleColumnValueFilter =
|
||||||
new SingleColumnValueFilter(Bytes.toBytes("family"), Bytes.toBytes("qualifier"),
|
new SingleColumnValueFilter(Bytes.toBytes("family"), Bytes.toBytes("qualifier"),
|
||||||
CompareFilter.CompareOp.NOT_EQUAL, new NullComparator(), true, true);
|
CompareOperator.NOT_EQUAL, new NullComparator(), true, true);
|
||||||
assertTrue(singleColumnValueFilter.areSerializedFieldsEqual(
|
assertTrue(singleColumnValueFilter.areSerializedFieldsEqual(
|
||||||
ProtobufUtil.toFilter(ProtobufUtil.toFilter(singleColumnValueFilter))));
|
ProtobufUtil.toFilter(ProtobufUtil.toFilter(singleColumnValueFilter))));
|
||||||
}
|
}
|
||||||
|
@ -309,7 +310,7 @@ public class TestFilterSerialization {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testValueFilter() throws Exception {
|
public void testValueFilter() throws Exception {
|
||||||
ValueFilter valueFilter = new ValueFilter(CompareFilter.CompareOp.NO_OP,
|
ValueFilter valueFilter = new ValueFilter(CompareOperator.NO_OP,
|
||||||
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
new BinaryComparator(Bytes.toBytes("testValueOne")));
|
||||||
assertTrue(valueFilter.areSerializedFieldsEqual(
|
assertTrue(valueFilter.areSerializedFieldsEqual(
|
||||||
ProtobufUtil.toFilter(ProtobufUtil.toFilter(valueFilter))));
|
ProtobufUtil.toFilter(ProtobufUtil.toFilter(valueFilter))));
|
||||||
|
|
|
@ -30,6 +30,7 @@ import java.util.List;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.hbase.Cell;
|
import org.apache.hadoop.hbase.Cell;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.TableName;
|
import org.apache.hadoop.hbase.TableName;
|
||||||
import org.apache.hadoop.hbase.client.Put;
|
import org.apache.hadoop.hbase.client.Put;
|
||||||
import org.apache.hadoop.hbase.client.Result;
|
import org.apache.hadoop.hbase.client.Result;
|
||||||
|
@ -63,7 +64,7 @@ public class TestFilterWithScanLimits extends FilterTestingCluster {
|
||||||
scan.setBatch(2);
|
scan.setBatch(2);
|
||||||
SingleColumnValueFilter filter = new SingleColumnValueFilter(
|
SingleColumnValueFilter filter = new SingleColumnValueFilter(
|
||||||
Bytes.toBytes(columnFamily), Bytes.toBytes("c5"),
|
Bytes.toBytes(columnFamily), Bytes.toBytes("c5"),
|
||||||
CompareFilter.CompareOp.EQUAL, new SubstringComparator("2_c5"));
|
CompareOperator .EQUAL, new SubstringComparator("2_c5"));
|
||||||
|
|
||||||
// add filter after batch defined
|
// add filter after batch defined
|
||||||
scan.setFilter(filter);
|
scan.setFilter(filter);
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.hbase.Cell;
|
import org.apache.hadoop.hbase.Cell;
|
||||||
import org.apache.hadoop.hbase.CellUtil;
|
import org.apache.hadoop.hbase.CellUtil;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||||
|
@ -78,7 +79,7 @@ public class TestFilterWrapper {
|
||||||
List<Filter> fs = new ArrayList<>();
|
List<Filter> fs = new ArrayList<>();
|
||||||
|
|
||||||
DependentColumnFilter f1 = new DependentColumnFilter(Bytes.toBytes("f1"),
|
DependentColumnFilter f1 = new DependentColumnFilter(Bytes.toBytes("f1"),
|
||||||
Bytes.toBytes("c5"), true, CompareFilter.CompareOp.EQUAL,
|
Bytes.toBytes("c5"), true, CompareOperator.EQUAL,
|
||||||
new SubstringComparator("c5"));
|
new SubstringComparator("c5"));
|
||||||
PageFilter f2 = new PageFilter(2);
|
PageFilter f2 = new PageFilter(2);
|
||||||
fs.add(f1);
|
fs.add(f1);
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
|
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
|
||||||
import org.apache.hadoop.hbase.testclassification.SmallTests;
|
import org.apache.hadoop.hbase.testclassification.SmallTests;
|
||||||
import org.apache.hadoop.hbase.util.Bytes;
|
import org.apache.hadoop.hbase.util.Bytes;
|
||||||
|
@ -242,7 +243,7 @@ public class TestParseFilter {
|
||||||
String filterString = "RowFilter ( =, 'binary:regionse')";
|
String filterString = "RowFilter ( =, 'binary:regionse')";
|
||||||
RowFilter rowFilter =
|
RowFilter rowFilter =
|
||||||
doTestFilter(filterString, RowFilter.class);
|
doTestFilter(filterString, RowFilter.class);
|
||||||
assertEquals(CompareFilter.CompareOp.EQUAL, rowFilter.getOperator());
|
assertEquals(CompareOperator.EQUAL, rowFilter.getCompareOperator());
|
||||||
assertTrue(rowFilter.getComparator() instanceof BinaryComparator);
|
assertTrue(rowFilter.getComparator() instanceof BinaryComparator);
|
||||||
BinaryComparator binaryComparator = (BinaryComparator) rowFilter.getComparator();
|
BinaryComparator binaryComparator = (BinaryComparator) rowFilter.getComparator();
|
||||||
assertEquals("regionse", new String(binaryComparator.getValue()));
|
assertEquals("regionse", new String(binaryComparator.getValue()));
|
||||||
|
@ -253,7 +254,7 @@ public class TestParseFilter {
|
||||||
String filterString = "FamilyFilter(>=, 'binaryprefix:pre')";
|
String filterString = "FamilyFilter(>=, 'binaryprefix:pre')";
|
||||||
FamilyFilter familyFilter =
|
FamilyFilter familyFilter =
|
||||||
doTestFilter(filterString, FamilyFilter.class);
|
doTestFilter(filterString, FamilyFilter.class);
|
||||||
assertEquals(CompareFilter.CompareOp.GREATER_OR_EQUAL, familyFilter.getOperator());
|
assertEquals(CompareOperator.GREATER_OR_EQUAL, familyFilter.getCompareOperator());
|
||||||
assertTrue(familyFilter.getComparator() instanceof BinaryPrefixComparator);
|
assertTrue(familyFilter.getComparator() instanceof BinaryPrefixComparator);
|
||||||
BinaryPrefixComparator binaryPrefixComparator =
|
BinaryPrefixComparator binaryPrefixComparator =
|
||||||
(BinaryPrefixComparator) familyFilter.getComparator();
|
(BinaryPrefixComparator) familyFilter.getComparator();
|
||||||
|
@ -265,7 +266,7 @@ public class TestParseFilter {
|
||||||
String filterString = "QualifierFilter(=, 'regexstring:pre*')";
|
String filterString = "QualifierFilter(=, 'regexstring:pre*')";
|
||||||
QualifierFilter qualifierFilter =
|
QualifierFilter qualifierFilter =
|
||||||
doTestFilter(filterString, QualifierFilter.class);
|
doTestFilter(filterString, QualifierFilter.class);
|
||||||
assertEquals(CompareFilter.CompareOp.EQUAL, qualifierFilter.getOperator());
|
assertEquals(CompareOperator.EQUAL, qualifierFilter.getCompareOperator());
|
||||||
assertTrue(qualifierFilter.getComparator() instanceof RegexStringComparator);
|
assertTrue(qualifierFilter.getComparator() instanceof RegexStringComparator);
|
||||||
RegexStringComparator regexStringComparator =
|
RegexStringComparator regexStringComparator =
|
||||||
(RegexStringComparator) qualifierFilter.getComparator();
|
(RegexStringComparator) qualifierFilter.getComparator();
|
||||||
|
@ -277,7 +278,7 @@ public class TestParseFilter {
|
||||||
String filterString = "ValueFilter(!=, 'substring:pre')";
|
String filterString = "ValueFilter(!=, 'substring:pre')";
|
||||||
ValueFilter valueFilter =
|
ValueFilter valueFilter =
|
||||||
doTestFilter(filterString, ValueFilter.class);
|
doTestFilter(filterString, ValueFilter.class);
|
||||||
assertEquals(CompareFilter.CompareOp.NOT_EQUAL, valueFilter.getOperator());
|
assertEquals(CompareOperator.NOT_EQUAL, valueFilter.getCompareOperator());
|
||||||
assertTrue(valueFilter.getComparator() instanceof SubstringComparator);
|
assertTrue(valueFilter.getComparator() instanceof SubstringComparator);
|
||||||
SubstringComparator substringComparator =
|
SubstringComparator substringComparator =
|
||||||
(SubstringComparator) valueFilter.getComparator();
|
(SubstringComparator) valueFilter.getComparator();
|
||||||
|
@ -303,7 +304,7 @@ public class TestParseFilter {
|
||||||
assertEquals("family", new String(dependentColumnFilter.getFamily()));
|
assertEquals("family", new String(dependentColumnFilter.getFamily()));
|
||||||
assertEquals("qualifier", new String(dependentColumnFilter.getQualifier()));
|
assertEquals("qualifier", new String(dependentColumnFilter.getQualifier()));
|
||||||
assertTrue(dependentColumnFilter.getDropDependentColumn());
|
assertTrue(dependentColumnFilter.getDropDependentColumn());
|
||||||
assertEquals(CompareFilter.CompareOp.EQUAL, dependentColumnFilter.getOperator());
|
assertEquals(CompareOperator.EQUAL, dependentColumnFilter.getCompareOperator());
|
||||||
assertTrue(dependentColumnFilter.getComparator() instanceof BinaryComparator);
|
assertTrue(dependentColumnFilter.getComparator() instanceof BinaryComparator);
|
||||||
BinaryComparator binaryComparator = (BinaryComparator)dependentColumnFilter.getComparator();
|
BinaryComparator binaryComparator = (BinaryComparator)dependentColumnFilter.getComparator();
|
||||||
assertEquals("abc", new String(binaryComparator.getValue()));
|
assertEquals("abc", new String(binaryComparator.getValue()));
|
||||||
|
@ -317,7 +318,7 @@ public class TestParseFilter {
|
||||||
doTestFilter(filterString, SingleColumnValueFilter.class);
|
doTestFilter(filterString, SingleColumnValueFilter.class);
|
||||||
assertEquals("family", new String(singleColumnValueFilter.getFamily()));
|
assertEquals("family", new String(singleColumnValueFilter.getFamily()));
|
||||||
assertEquals("qualifier", new String(singleColumnValueFilter.getQualifier()));
|
assertEquals("qualifier", new String(singleColumnValueFilter.getQualifier()));
|
||||||
assertEquals(singleColumnValueFilter.getOperator(), CompareFilter.CompareOp.GREATER_OR_EQUAL);
|
assertEquals(singleColumnValueFilter.getCompareOperator(), CompareOperator.GREATER_OR_EQUAL);
|
||||||
assertTrue(singleColumnValueFilter.getComparator() instanceof BinaryComparator);
|
assertTrue(singleColumnValueFilter.getComparator() instanceof BinaryComparator);
|
||||||
BinaryComparator binaryComparator = (BinaryComparator) singleColumnValueFilter.getComparator();
|
BinaryComparator binaryComparator = (BinaryComparator) singleColumnValueFilter.getComparator();
|
||||||
assertEquals(new String(binaryComparator.getValue()), "a");
|
assertEquals(new String(binaryComparator.getValue()), "a");
|
||||||
|
@ -329,7 +330,7 @@ public class TestParseFilter {
|
||||||
singleColumnValueFilter = doTestFilter(filterString, SingleColumnValueFilter.class);
|
singleColumnValueFilter = doTestFilter(filterString, SingleColumnValueFilter.class);
|
||||||
assertEquals("family", new String(singleColumnValueFilter.getFamily()));
|
assertEquals("family", new String(singleColumnValueFilter.getFamily()));
|
||||||
assertEquals("qualifier", new String(singleColumnValueFilter.getQualifier()));
|
assertEquals("qualifier", new String(singleColumnValueFilter.getQualifier()));
|
||||||
assertEquals(singleColumnValueFilter.getOperator(), CompareFilter.CompareOp.GREATER);
|
assertEquals(singleColumnValueFilter.getCompareOperator(), CompareOperator.GREATER);
|
||||||
assertTrue(singleColumnValueFilter.getComparator() instanceof BinaryPrefixComparator);
|
assertTrue(singleColumnValueFilter.getComparator() instanceof BinaryPrefixComparator);
|
||||||
BinaryPrefixComparator binaryPrefixComparator =
|
BinaryPrefixComparator binaryPrefixComparator =
|
||||||
(BinaryPrefixComparator) singleColumnValueFilter.getComparator();
|
(BinaryPrefixComparator) singleColumnValueFilter.getComparator();
|
||||||
|
@ -344,7 +345,7 @@ public class TestParseFilter {
|
||||||
"SingleColumnValueExcludeFilter ('family', 'qualifier', <, 'binaryprefix:a')";
|
"SingleColumnValueExcludeFilter ('family', 'qualifier', <, 'binaryprefix:a')";
|
||||||
SingleColumnValueExcludeFilter singleColumnValueExcludeFilter =
|
SingleColumnValueExcludeFilter singleColumnValueExcludeFilter =
|
||||||
doTestFilter(filterString, SingleColumnValueExcludeFilter.class);
|
doTestFilter(filterString, SingleColumnValueExcludeFilter.class);
|
||||||
assertEquals(singleColumnValueExcludeFilter.getOperator(), CompareFilter.CompareOp.LESS);
|
assertEquals(singleColumnValueExcludeFilter.getCompareOperator(), CompareOperator.LESS);
|
||||||
assertEquals("family", new String(singleColumnValueExcludeFilter.getFamily()));
|
assertEquals("family", new String(singleColumnValueExcludeFilter.getFamily()));
|
||||||
assertEquals("qualifier", new String(singleColumnValueExcludeFilter.getQualifier()));
|
assertEquals("qualifier", new String(singleColumnValueExcludeFilter.getQualifier()));
|
||||||
assertEquals(new String(singleColumnValueExcludeFilter.getComparator().getValue()), "a");
|
assertEquals(new String(singleColumnValueExcludeFilter.getComparator().getValue()), "a");
|
||||||
|
@ -357,8 +358,8 @@ public class TestParseFilter {
|
||||||
doTestFilter(filterString, SingleColumnValueExcludeFilter.class);
|
doTestFilter(filterString, SingleColumnValueExcludeFilter.class);
|
||||||
assertEquals("family", new String(singleColumnValueExcludeFilter.getFamily()));
|
assertEquals("family", new String(singleColumnValueExcludeFilter.getFamily()));
|
||||||
assertEquals("qualifier", new String(singleColumnValueExcludeFilter.getQualifier()));
|
assertEquals("qualifier", new String(singleColumnValueExcludeFilter.getQualifier()));
|
||||||
assertEquals(singleColumnValueExcludeFilter.getOperator(),
|
assertEquals(singleColumnValueExcludeFilter.getCompareOperator(),
|
||||||
CompareFilter.CompareOp.LESS_OR_EQUAL);
|
CompareOperator.LESS_OR_EQUAL);
|
||||||
assertTrue(singleColumnValueExcludeFilter.getComparator() instanceof BinaryPrefixComparator);
|
assertTrue(singleColumnValueExcludeFilter.getComparator() instanceof BinaryPrefixComparator);
|
||||||
BinaryPrefixComparator binaryPrefixComparator =
|
BinaryPrefixComparator binaryPrefixComparator =
|
||||||
(BinaryPrefixComparator) singleColumnValueExcludeFilter.getComparator();
|
(BinaryPrefixComparator) singleColumnValueExcludeFilter.getComparator();
|
||||||
|
@ -375,7 +376,7 @@ public class TestParseFilter {
|
||||||
assertTrue(skipFilter.getFilter() instanceof ValueFilter);
|
assertTrue(skipFilter.getFilter() instanceof ValueFilter);
|
||||||
ValueFilter valueFilter = (ValueFilter) skipFilter.getFilter();
|
ValueFilter valueFilter = (ValueFilter) skipFilter.getFilter();
|
||||||
|
|
||||||
assertEquals(CompareFilter.CompareOp.EQUAL, valueFilter.getOperator());
|
assertEquals(CompareOperator.EQUAL, valueFilter.getCompareOperator());
|
||||||
assertTrue(valueFilter.getComparator() instanceof BinaryComparator);
|
assertTrue(valueFilter.getComparator() instanceof BinaryComparator);
|
||||||
BinaryComparator binaryComparator = (BinaryComparator) valueFilter.getComparator();
|
BinaryComparator binaryComparator = (BinaryComparator) valueFilter.getComparator();
|
||||||
assertEquals("0", new String(binaryComparator.getValue()));
|
assertEquals("0", new String(binaryComparator.getValue()));
|
||||||
|
@ -389,7 +390,7 @@ public class TestParseFilter {
|
||||||
assertTrue(whileMatchFilter.getFilter() instanceof RowFilter);
|
assertTrue(whileMatchFilter.getFilter() instanceof RowFilter);
|
||||||
RowFilter rowFilter = (RowFilter) whileMatchFilter.getFilter();
|
RowFilter rowFilter = (RowFilter) whileMatchFilter.getFilter();
|
||||||
|
|
||||||
assertEquals(CompareFilter.CompareOp.NOT_EQUAL, rowFilter.getOperator());
|
assertEquals(CompareOperator.NOT_EQUAL, rowFilter.getCompareOperator());
|
||||||
assertTrue(rowFilter.getComparator() instanceof BinaryComparator);
|
assertTrue(rowFilter.getComparator() instanceof BinaryComparator);
|
||||||
BinaryComparator binaryComparator = (BinaryComparator) rowFilter.getComparator();
|
BinaryComparator binaryComparator = (BinaryComparator) rowFilter.getComparator();
|
||||||
assertEquals("row1", new String(binaryComparator.getValue()));
|
assertEquals("row1", new String(binaryComparator.getValue()));
|
||||||
|
@ -429,7 +430,7 @@ public class TestParseFilter {
|
||||||
assertTrue(filterListFilters.get(1) instanceof QualifierFilter);
|
assertTrue(filterListFilters.get(1) instanceof QualifierFilter);
|
||||||
assertEquals(filterList.getOperator(), FilterList.Operator.MUST_PASS_ALL);
|
assertEquals(filterList.getOperator(), FilterList.Operator.MUST_PASS_ALL);
|
||||||
|
|
||||||
assertEquals(CompareFilter.CompareOp.EQUAL, familyFilter.getOperator());
|
assertEquals(CompareOperator.EQUAL, familyFilter.getCompareOperator());
|
||||||
assertTrue(familyFilter.getComparator() instanceof BinaryComparator);
|
assertTrue(familyFilter.getComparator() instanceof BinaryComparator);
|
||||||
BinaryComparator binaryComparator = (BinaryComparator) familyFilter.getComparator();
|
BinaryComparator binaryComparator = (BinaryComparator) familyFilter.getComparator();
|
||||||
assertEquals("qualifier", new String(binaryComparator.getValue()));
|
assertEquals("qualifier", new String(binaryComparator.getValue()));
|
||||||
|
@ -439,7 +440,7 @@ public class TestParseFilter {
|
||||||
assertEquals(new String(prefix), "realtime");
|
assertEquals(new String(prefix), "realtime");
|
||||||
|
|
||||||
QualifierFilter qualifierFilter = (QualifierFilter) filterListFilters.get(1);
|
QualifierFilter qualifierFilter = (QualifierFilter) filterListFilters.get(1);
|
||||||
assertEquals(CompareFilter.CompareOp.GREATER_OR_EQUAL, qualifierFilter.getOperator());
|
assertEquals(CompareOperator.GREATER_OR_EQUAL, qualifierFilter.getCompareOperator());
|
||||||
assertTrue(qualifierFilter.getComparator() instanceof BinaryComparator);
|
assertTrue(qualifierFilter.getComparator() instanceof BinaryComparator);
|
||||||
binaryComparator = (BinaryComparator) qualifierFilter.getComparator();
|
binaryComparator = (BinaryComparator) qualifierFilter.getComparator();
|
||||||
assertEquals("e", new String(binaryComparator.getValue()));
|
assertEquals("e", new String(binaryComparator.getValue()));
|
||||||
|
@ -472,7 +473,7 @@ public class TestParseFilter {
|
||||||
assertTrue(skipFilter.getFilter() instanceof FamilyFilter);
|
assertTrue(skipFilter.getFilter() instanceof FamilyFilter);
|
||||||
FamilyFilter familyFilter = (FamilyFilter) skipFilter.getFilter();
|
FamilyFilter familyFilter = (FamilyFilter) skipFilter.getFilter();
|
||||||
|
|
||||||
assertEquals(CompareFilter.CompareOp.EQUAL, familyFilter.getOperator());
|
assertEquals(CompareOperator.EQUAL, familyFilter.getCompareOperator());
|
||||||
assertTrue(familyFilter.getComparator() instanceof SubstringComparator);
|
assertTrue(familyFilter.getComparator() instanceof SubstringComparator);
|
||||||
SubstringComparator substringComparator =
|
SubstringComparator substringComparator =
|
||||||
(SubstringComparator) familyFilter.getComparator();
|
(SubstringComparator) familyFilter.getComparator();
|
||||||
|
@ -501,7 +502,7 @@ public class TestParseFilter {
|
||||||
assertTrue(skipFilter.getFilter() instanceof FamilyFilter);
|
assertTrue(skipFilter.getFilter() instanceof FamilyFilter);
|
||||||
FamilyFilter familyFilter = (FamilyFilter) skipFilter.getFilter();
|
FamilyFilter familyFilter = (FamilyFilter) skipFilter.getFilter();
|
||||||
|
|
||||||
assertEquals(CompareFilter.CompareOp.EQUAL, familyFilter.getOperator());
|
assertEquals(CompareOperator.EQUAL, familyFilter.getCompareOperator());
|
||||||
assertTrue(familyFilter.getComparator() instanceof SubstringComparator);
|
assertTrue(familyFilter.getComparator() instanceof SubstringComparator);
|
||||||
SubstringComparator substringComparator =
|
SubstringComparator substringComparator =
|
||||||
(SubstringComparator) familyFilter.getComparator();
|
(SubstringComparator) familyFilter.getComparator();
|
||||||
|
@ -670,6 +671,4 @@ public class TestParseFilter {
|
||||||
assertEquals(clazz, filter.getClass());
|
assertEquals(clazz, filter.getClass());
|
||||||
return clazz.cast(filter);
|
return clazz.cast(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.filter;
|
||||||
|
|
||||||
import org.apache.hadoop.hbase.Cell;
|
import org.apache.hadoop.hbase.Cell;
|
||||||
import org.apache.hadoop.hbase.CellComparator;
|
import org.apache.hadoop.hbase.CellComparator;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.KeyValue;
|
import org.apache.hadoop.hbase.KeyValue;
|
||||||
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
|
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
|
||||||
import org.apache.hadoop.hbase.testclassification.FilterTests;
|
import org.apache.hadoop.hbase.testclassification.FilterTests;
|
||||||
|
@ -55,7 +56,7 @@ public class TestSingleColumnValueExcludeFilter {
|
||||||
@Test
|
@Test
|
||||||
public void testFilterKeyValue() throws Exception {
|
public void testFilterKeyValue() throws Exception {
|
||||||
Filter filter = new SingleColumnValueExcludeFilter(COLUMN_FAMILY, COLUMN_QUALIFIER,
|
Filter filter = new SingleColumnValueExcludeFilter(COLUMN_FAMILY, COLUMN_QUALIFIER,
|
||||||
CompareOp.EQUAL, VAL_1);
|
CompareOperator.EQUAL, VAL_1);
|
||||||
|
|
||||||
// A 'match' situation
|
// A 'match' situation
|
||||||
List<Cell> kvs = new ArrayList<>();
|
List<Cell> kvs = new ArrayList<>();
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.util.regex.Pattern;
|
||||||
import org.apache.hadoop.hbase.ByteBufferKeyValue;
|
import org.apache.hadoop.hbase.ByteBufferKeyValue;
|
||||||
|
|
||||||
import org.apache.hadoop.hbase.Cell;
|
import org.apache.hadoop.hbase.Cell;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.KeyValue;
|
import org.apache.hadoop.hbase.KeyValue;
|
||||||
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
|
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
|
||||||
import org.apache.hadoop.hbase.testclassification.FilterTests;
|
import org.apache.hadoop.hbase.testclassification.FilterTests;
|
||||||
|
@ -73,36 +74,36 @@ public class TestSingleColumnValueFilter {
|
||||||
|
|
||||||
private Filter basicFilterNew() {
|
private Filter basicFilterNew() {
|
||||||
return new SingleColumnValueFilter(COLUMN_FAMILY, COLUMN_QUALIFIER,
|
return new SingleColumnValueFilter(COLUMN_FAMILY, COLUMN_QUALIFIER,
|
||||||
CompareOp.GREATER_OR_EQUAL, VAL_2);
|
CompareOperator.GREATER_OR_EQUAL, VAL_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Filter nullFilterNew() {
|
private Filter nullFilterNew() {
|
||||||
return new SingleColumnValueFilter(COLUMN_FAMILY, COLUMN_QUALIFIER, CompareOp.NOT_EQUAL,
|
return new SingleColumnValueFilter(COLUMN_FAMILY, COLUMN_QUALIFIER, CompareOperator.NOT_EQUAL,
|
||||||
new NullComparator());
|
new NullComparator());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Filter substrFilterNew() {
|
private Filter substrFilterNew() {
|
||||||
return new SingleColumnValueFilter(COLUMN_FAMILY, COLUMN_QUALIFIER,
|
return new SingleColumnValueFilter(COLUMN_FAMILY, COLUMN_QUALIFIER,
|
||||||
CompareOp.EQUAL,
|
CompareOperator.EQUAL,
|
||||||
new SubstringComparator(QUICK_SUBSTR));
|
new SubstringComparator(QUICK_SUBSTR));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Filter regexFilterNew() {
|
private Filter regexFilterNew() {
|
||||||
return new SingleColumnValueFilter(COLUMN_FAMILY, COLUMN_QUALIFIER,
|
return new SingleColumnValueFilter(COLUMN_FAMILY, COLUMN_QUALIFIER,
|
||||||
CompareOp.EQUAL,
|
CompareOperator.EQUAL,
|
||||||
new RegexStringComparator(QUICK_REGEX));
|
new RegexStringComparator(QUICK_REGEX));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Filter regexFilterNew(Pattern pattern) {
|
private Filter regexFilterNew(Pattern pattern) {
|
||||||
return new SingleColumnValueFilter(COLUMN_FAMILY, COLUMN_QUALIFIER,
|
return new SingleColumnValueFilter(COLUMN_FAMILY, COLUMN_QUALIFIER,
|
||||||
CompareOp.EQUAL,
|
CompareOperator.EQUAL,
|
||||||
new RegexStringComparator(pattern.pattern(), pattern.flags()));
|
new RegexStringComparator(pattern.pattern(), pattern.flags()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLongComparator() throws IOException {
|
public void testLongComparator() throws IOException {
|
||||||
Filter filter = new SingleColumnValueFilter(COLUMN_FAMILY,
|
Filter filter = new SingleColumnValueFilter(COLUMN_FAMILY,
|
||||||
COLUMN_QUALIFIER, CompareOp.GREATER, new LongComparator(100L));
|
COLUMN_QUALIFIER, CompareOperator.GREATER, new LongComparator(100L));
|
||||||
KeyValue kv = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER,
|
KeyValue kv = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER,
|
||||||
Bytes.toBytes(1L));
|
Bytes.toBytes(1L));
|
||||||
assertTrue("less than", filter.filterKeyValue(kv) == Filter.ReturnCode.NEXT_ROW);
|
assertTrue("less than", filter.filterKeyValue(kv) == Filter.ReturnCode.NEXT_ROW);
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
import org.apache.hadoop.hbase.HRegionInfo;
|
import org.apache.hadoop.hbase.HRegionInfo;
|
||||||
import org.apache.hadoop.hbase.HRegionLocation;
|
import org.apache.hadoop.hbase.HRegionLocation;
|
||||||
import org.apache.hadoop.hbase.ServerName;
|
import org.apache.hadoop.hbase.ServerName;
|
||||||
|
@ -570,15 +571,15 @@ public class ThriftUtilities {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CompareOp compareOpFromThrift(TCompareOp tCompareOp) {
|
public static CompareOperator compareOpFromThrift(TCompareOp tCompareOp) {
|
||||||
switch (tCompareOp.getValue()) {
|
switch (tCompareOp.getValue()) {
|
||||||
case 0: return CompareOp.LESS;
|
case 0: return CompareOperator.LESS;
|
||||||
case 1: return CompareOp.LESS_OR_EQUAL;
|
case 1: return CompareOperator.LESS_OR_EQUAL;
|
||||||
case 2: return CompareOp.EQUAL;
|
case 2: return CompareOperator.EQUAL;
|
||||||
case 3: return CompareOp.NOT_EQUAL;
|
case 3: return CompareOperator.NOT_EQUAL;
|
||||||
case 4: return CompareOp.GREATER_OR_EQUAL;
|
case 4: return CompareOperator.GREATER_OR_EQUAL;
|
||||||
case 5: return CompareOp.GREATER;
|
case 5: return CompareOperator.GREATER;
|
||||||
case 6: return CompareOp.NO_OP;
|
case 6: return CompareOperator.NO_OP;
|
||||||
default: return null;
|
default: return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,14 +273,14 @@ FilterList list = new FilterList(FilterList.Operator.MUST_PASS_ONE);
|
||||||
SingleColumnValueFilter filter1 = new SingleColumnValueFilter(
|
SingleColumnValueFilter filter1 = new SingleColumnValueFilter(
|
||||||
cf,
|
cf,
|
||||||
column,
|
column,
|
||||||
CompareOp.EQUAL,
|
CompareOperator.EQUAL,
|
||||||
Bytes.toBytes("my value")
|
Bytes.toBytes("my value")
|
||||||
);
|
);
|
||||||
list.add(filter1);
|
list.add(filter1);
|
||||||
SingleColumnValueFilter filter2 = new SingleColumnValueFilter(
|
SingleColumnValueFilter filter2 = new SingleColumnValueFilter(
|
||||||
cf,
|
cf,
|
||||||
column,
|
column,
|
||||||
CompareOp.EQUAL,
|
CompareOperator.EQUAL,
|
||||||
Bytes.toBytes("my other value")
|
Bytes.toBytes("my other value")
|
||||||
);
|
);
|
||||||
list.add(filter2);
|
list.add(filter2);
|
||||||
|
@ -295,8 +295,8 @@ scan.setFilter(list);
|
||||||
|
|
||||||
A SingleColumnValueFilter (see:
|
A SingleColumnValueFilter (see:
|
||||||
http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/filter/SingleColumnValueFilter.html)
|
http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/filter/SingleColumnValueFilter.html)
|
||||||
can be used to test column values for equivalence (`CompareOp.EQUAL`),
|
can be used to test column values for equivalence (`CompareOperaor.EQUAL`),
|
||||||
inequality (`CompareOp.NOT_EQUAL`), or ranges (e.g., `CompareOp.GREATER`). The following is an
|
inequality (`CompareOperaor.NOT_EQUAL`), or ranges (e.g., `CompareOperaor.GREATER`). The following is an
|
||||||
example of testing equivalence of a column to a String value "my value"...
|
example of testing equivalence of a column to a String value "my value"...
|
||||||
|
|
||||||
[source,java]
|
[source,java]
|
||||||
|
@ -304,7 +304,7 @@ example of testing equivalence of a column to a String value "my value"...
|
||||||
SingleColumnValueFilter filter = new SingleColumnValueFilter(
|
SingleColumnValueFilter filter = new SingleColumnValueFilter(
|
||||||
cf,
|
cf,
|
||||||
column,
|
column,
|
||||||
CompareOp.EQUAL,
|
CompareOperaor.EQUAL,
|
||||||
Bytes.toBytes("my value")
|
Bytes.toBytes("my value")
|
||||||
);
|
);
|
||||||
scan.setFilter(filter);
|
scan.setFilter(filter);
|
||||||
|
@ -327,7 +327,7 @@ RegexStringComparator comp = new RegexStringComparator("my."); // any value th
|
||||||
SingleColumnValueFilter filter = new SingleColumnValueFilter(
|
SingleColumnValueFilter filter = new SingleColumnValueFilter(
|
||||||
cf,
|
cf,
|
||||||
column,
|
column,
|
||||||
CompareOp.EQUAL,
|
CompareOperaor.EQUAL,
|
||||||
comp
|
comp
|
||||||
);
|
);
|
||||||
scan.setFilter(filter);
|
scan.setFilter(filter);
|
||||||
|
@ -348,7 +348,7 @@ SubstringComparator comp = new SubstringComparator("y val"); // looking for 'm
|
||||||
SingleColumnValueFilter filter = new SingleColumnValueFilter(
|
SingleColumnValueFilter filter = new SingleColumnValueFilter(
|
||||||
cf,
|
cf,
|
||||||
column,
|
column,
|
||||||
CompareOp.EQUAL,
|
CompareOperaor.EQUAL,
|
||||||
comp
|
comp
|
||||||
);
|
);
|
||||||
scan.setFilter(filter);
|
scan.setFilter(filter);
|
||||||
|
|
Loading…
Reference in New Issue