下面列出了org.apache.hadoop.hbase.CompareOperator#NO_OP 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public static CompareOperator compareOpFromThrift(TCompareOperator tCompareOp) {
switch (tCompareOp.getValue()) {
case 0: return CompareOperator.LESS;
case 1: return CompareOperator.LESS_OR_EQUAL;
case 2: return CompareOperator.EQUAL;
case 3: return CompareOperator.NOT_EQUAL;
case 4: return CompareOperator.GREATER_OR_EQUAL;
case 5: return CompareOperator.GREATER;
case 6: return CompareOperator.NO_OP;
default: return null;
}
}
@Test
public void testValueFilter() throws Exception {
ValueFilter valueFilter = new ValueFilter(CompareOperator.NO_OP,
new BinaryComparator(Bytes.toBytes("testValueOne")));
assertTrue(valueFilter.areSerializedFieldsEqual(
ProtobufUtil.toFilter(ProtobufUtil.toFilter(valueFilter))));
}
protected boolean compareRow(final CompareOperator op, final ByteArrayComparable comparator,
final Cell cell) {
if (op == CompareOperator.NO_OP) {
return true;
}
int compareResult = PrivateCellUtil.compareRow(cell, comparator);
return compare(op, compareResult);
}
protected boolean compareFamily(final CompareOperator op, final ByteArrayComparable comparator,
final Cell cell) {
if (op == CompareOperator.NO_OP) {
return true;
}
int compareResult = PrivateCellUtil.compareFamily(cell, comparator);
return compare(op, 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 = PrivateCellUtil.compareQualifier(cell, comparator);
return compare(op, compareResult);
}
protected boolean compareValue(final CompareOperator op, final ByteArrayComparable comparator,
final Cell cell) {
if (op == CompareOperator.NO_OP) {
return true;
}
int compareResult = PrivateCellUtil.compareValue(cell, comparator);
return compare(op, compareResult);
}
/**
* This method is used to determine a cell should be included or filtered out.
* @param op one of operators {@link CompareOperator}
* @param comparator comparator used to compare cells.
* @param cell cell to be compared.
* @return true means cell should be filtered out, included otherwise.
*/
private boolean compareValue(final CompareOperator op, final ByteArrayComparable comparator,
final Cell cell) {
if (op == CompareOperator.NO_OP) {
return true;
}
int compareResult = PrivateCellUtil.compareValue(cell, comparator);
return CompareFilter.compare(op, compareResult);
}
/**
* Constructor for DependentColumn filter.
* Cells where a Cell from target column
* with the same timestamp do not exist will be dropped.
*
* @param family name of dependent column family
* @param qualifier name of dependent qualifier
* @param dropDependentColumn whether the dependent columns Cells should be discarded
*/
public DependentColumnFilter(final byte [] family, final byte [] qualifier,
final boolean dropDependentColumn) {
this(family, qualifier, dropDependentColumn, CompareOperator.NO_OP, null);
}