Java Code Examples for org.apache.hadoop.hbase.CompareOperator#GREATER_OR_EQUAL

The following examples show how to use org.apache.hadoop.hbase.CompareOperator#GREATER_OR_EQUAL . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HbaseQuery.java    From tephra with MIT License 6 votes vote down vote up
protected CompareOperator getCompare(Where where) {
    if (where == Where.Equals)
        return CompareOperator.EQUAL;

    if (where == Where.NotEquals)
        return CompareOperator.NOT_EQUAL;

    if (where == Where.Less)
        return CompareOperator.LESS;

    if (where == Where.LessEquals)
        return CompareOperator.LESS_OR_EQUAL;

    if (where == Where.Greater)
        return CompareOperator.GREATER;

    if (where == Where.GreaterEquals)
        return CompareOperator.GREATER_OR_EQUAL;

    return CompareOperator.EQUAL;
}
 
Example 2
Source File: TestFilterSerialization.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Test
public void testSingleColumnValueExcludeFilter() throws Exception {
  // null family/column SingleColumnValueExcludeFilter
  SingleColumnValueExcludeFilter singleColumnValueExcludeFilter =
    new SingleColumnValueExcludeFilter(null, null,
    CompareOperator.GREATER_OR_EQUAL, Bytes.toBytes("value"));
  assertTrue(singleColumnValueExcludeFilter.areSerializedFieldsEqual(
    ProtobufUtil.toFilter(ProtobufUtil.toFilter(singleColumnValueExcludeFilter))));

  // non-null family/column SingleColumnValueFilter
  singleColumnValueExcludeFilter =
    new SingleColumnValueExcludeFilter(Bytes.toBytes("fam"), Bytes.toBytes("qual"),
    CompareOperator.LESS_OR_EQUAL, new NullComparator(), false, false);
  assertTrue(singleColumnValueExcludeFilter.areSerializedFieldsEqual(
    ProtobufUtil.toFilter(ProtobufUtil.toFilter(singleColumnValueExcludeFilter))));
}
 
Example 3
Source File: ParseFilter.java    From hbase with Apache License 2.0 6 votes vote down vote up
/**
 * Takes a compareOperator symbol as a byte array and returns the corresponding CompareOperator
 * @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");
}
 
Example 4
Source File: ThriftUtilities.java    From hbase with Apache License 2.0 5 votes vote down vote up
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;
  }
}
 
Example 5
Source File: TestFilterSerialization.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Test
public void testDependentColumnFilter() throws Exception {
  // null column qualifier/family
  DependentColumnFilter dependentColumnFilter = new DependentColumnFilter(null, null);
  assertTrue(dependentColumnFilter.areSerializedFieldsEqual(
    ProtobufUtil.toFilter(ProtobufUtil.toFilter(dependentColumnFilter))));

  // non-null column qualifier/family
  dependentColumnFilter = new DependentColumnFilter(Bytes.toBytes("family"),
    Bytes.toBytes("qual"), true, CompareOperator.GREATER_OR_EQUAL,
    new BitComparator(Bytes.toBytes("bitComparator"), BitComparator.BitwiseOp.OR));
  assertTrue(dependentColumnFilter.areSerializedFieldsEqual(
    ProtobufUtil.toFilter(ProtobufUtil.toFilter(dependentColumnFilter))));
}
 
Example 6
Source File: TestSingleColumnValueFilter.java    From hbase with Apache License 2.0 4 votes vote down vote up
private Filter basicFilterNew() {
  return new SingleColumnValueFilter(COLUMN_FAMILY, COLUMN_QUALIFIER,
  CompareOperator.GREATER_OR_EQUAL, VAL_2);
}