本文整理汇总了Java中org.apache.hadoop.hbase.filter.CompareFilter.CompareOp.NOT_EQUAL属性的典型用法代码示例。如果您正苦于以下问题:Java CompareOp.NOT_EQUAL属性的具体用法?Java CompareOp.NOT_EQUAL怎么用?Java CompareOp.NOT_EQUAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.hadoop.hbase.filter.CompareFilter.CompareOp
的用法示例。
在下文中一共展示了CompareOp.NOT_EQUAL属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: printRange
public static String printRange(Range r) {
StringBuilder sb = new StringBuilder();
sb.append("[" + Bytes.toString(r.getFamily()) + ":" + Bytes.toString(r.getQualifier())
+ "], values (");
if (r.getStartValue() != null) {
sb.append(LCIndexConstant.getStringOfValueAndType(r.getDataType(), r.getStartValue()));
if (r.getStartType() == CompareOp.EQUAL || r.getStartType() == CompareOp.NOT_EQUAL) {
sb.append(" <== ").append(r.getStartType()).append(" )");
return sb.toString();
}
} else {
sb.append("null");
}
sb.append(", ");
if (r.getStopValue() != null) {
sb.append(LCIndexConstant.getStringOfValueAndType(r.getDataType(), r.getStopValue()));
} else {
sb.append("MAX");
}
sb.append(")");
return sb.toString();
}
示例2: fromFilter
public static Range[] fromFilter(SingleColumnValueFilter filter) {
if (!(filter.getComparator() instanceof BinaryComparator)) {
return new Range[0];
}
byte[] column = KeyValue.makeColumn(filter.getFamily(), filter.getQualifier());
CompareOp compareOp = filter.getOperator();
byte[] value = filter.getComparator().getValue();
if (compareOp == CompareOp.NOT_EQUAL) {
return new Range[] { new Range(column, null, CompareOp.NO_OP, value, CompareOp.LESS),
new Range(column, value, CompareOp.GREATER, null, CompareOp.NO_OP) };
} else {
switch (compareOp) {
case EQUAL:
case GREATER_OR_EQUAL:
case GREATER:
return new Range[] { new Range(column, value, compareOp, null, CompareOp.NO_OP) };
case LESS:
case LESS_OR_EQUAL:
return new Range[] { new Range(column, null, CompareOp.NO_OP, value, compareOp) };
default:
return new Range[0];
}
}
}
示例3: createCompareOp
/**
* Takes a compareOperator symbol as a byte array and returns the corresponding CompareOperator
* <p>
* @param compareOpAsByteArray the comparatorOperator symbol as a byte array
* @return the Compare Operator
*/
public static CompareFilter.CompareOp createCompareOp (byte [] compareOpAsByteArray) {
ByteBuffer compareOp = ByteBuffer.wrap(compareOpAsByteArray);
if (compareOp.equals(ParseConstants.LESS_THAN_BUFFER))
return CompareOp.LESS;
else if (compareOp.equals(ParseConstants.LESS_THAN_OR_EQUAL_TO_BUFFER))
return CompareOp.LESS_OR_EQUAL;
else if (compareOp.equals(ParseConstants.GREATER_THAN_BUFFER))
return CompareOp.GREATER;
else if (compareOp.equals(ParseConstants.GREATER_THAN_OR_EQUAL_TO_BUFFER))
return CompareOp.GREATER_OR_EQUAL;
else if (compareOp.equals(ParseConstants.NOT_EQUAL_TO_BUFFER))
return CompareOp.NOT_EQUAL;
else if (compareOp.equals(ParseConstants.EQUAL_TO_BUFFER))
return CompareOp.EQUAL;
else
throw new IllegalArgumentException("Invalid compare operator");
}
示例4: testSkipFilter
@Test
public void testSkipFilter() throws IOException {
// Test for qualifier regex: "testQualifierOne-2"
// Should only get rows from second group, and all keys
Filter f = new SkipFilter(new QualifierFilter(CompareOp.NOT_EQUAL,
new BinaryComparator(Bytes.toBytes("testQualifierOne-2"))));
Scan s = new Scan();
s.setFilter(f);
KeyValue [] kvs = {
// testRowTwo-0
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
// testRowTwo-2
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
// testRowTwo-3
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
};
verifyScanFull(s, kvs);
}
示例5: setStartType
/**
* Set start type for start value.
* @param startType - can only be EQUAL, GREATER, GREATER_OR_EQUAL or NO_OP
*/
public void setStartType(CompareOp startType) {
if (startType == CompareOp.LESS || startType == CompareOp.LESS_OR_EQUAL
|| startType == CompareOp.NOT_EQUAL) {
throw new IllegalArgumentException("Illegal start type: " + startType.toString());
}
this.startType = startType;
}
示例6: setStopType
/**
* Set end type for end value.
* @param stopType - can only be LESS , LESS_OR_EQUAL or NO_OP
*/
public void setStopType(CompareOp stopType) {
if (stopType == CompareOp.EQUAL || stopType == CompareOp.GREATER
|| stopType == CompareOp.GREATER_OR_EQUAL || stopType == CompareOp.NOT_EQUAL) {
throw new IllegalArgumentException("Illegal end type: " + stopType.toString());
}
this.stopType = stopType;
}
示例7: createFilterFromArguments
public static Filter createFilterFromArguments(ArrayList<byte []> filterArguments) {
Preconditions.checkArgument(filterArguments.size() == 4 || filterArguments.size() == 6,
"Expected 4 or 6 but got: %s", filterArguments.size());
byte [] family = ParseFilter.removeQuotesFromByteArray(filterArguments.get(0));
byte [] qualifier = ParseFilter.removeQuotesFromByteArray(filterArguments.get(1));
CompareOp compareOp = ParseFilter.createCompareOp(filterArguments.get(2));
ByteArrayComparable comparator = ParseFilter.createComparator(
ParseFilter.removeQuotesFromByteArray(filterArguments.get(3)));
if (comparator instanceof RegexStringComparator ||
comparator instanceof SubstringComparator) {
if (compareOp != CompareOp.EQUAL &&
compareOp != CompareOp.NOT_EQUAL) {
throw new IllegalArgumentException ("A regexstring comparator and substring comparator " +
"can only be used with EQUAL and NOT_EQUAL");
}
}
SingleColumnValueFilter filter = new SingleColumnValueFilter(family, qualifier,
compareOp, comparator);
if (filterArguments.size() == 6) {
boolean filterIfMissing = ParseFilter.convertByteArrayToBoolean(filterArguments.get(4));
boolean latestVersionOnly = ParseFilter.convertByteArrayToBoolean(filterArguments.get(5));
filter.setFilterIfMissing(filterIfMissing);
filter.setLatestVersionOnly(latestVersionOnly);
}
return filter;
}
示例8: testSkipFilter
@Test
public void testSkipFilter() throws Exception {
// Test for qualifier regex: "testQualifierOne-2"
// Should only get rows from second group, and all keys
Filter f = new SkipFilter(new QualifierFilter(CompareOp.NOT_EQUAL,
new BinaryComparator(Bytes.toBytes("testQualifierOne-2"))));
Scan s = new Scan();
s.setFilter(f);
KeyValue [] kvs = {
// testRowTwo-0
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[0], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
// testRowTwo-2
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[2], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
// testRowTwo-3
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[0], QUALIFIERS_TWO[3], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[0], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[2], VALUES[1]),
new KeyValue(ROWS_TWO[3], FAMILIES[1], QUALIFIERS_TWO[3], VALUES[1]),
};
verifyScanFull(s, kvs);
}
示例9: nullFilterNew
private Filter nullFilterNew() {
return new SingleColumnValueFilter(COLUMN_FAMILY, COLUMN_QUALIFIER, CompareOp.NOT_EQUAL,
new NullComparator());
}