當前位置: 首頁>>代碼示例>>Java>>正文


Java CompareOp.GREATER屬性代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.filter.CompareFilter.CompareOp.GREATER屬性的典型用法代碼示例。如果您正苦於以下問題:Java CompareOp.GREATER屬性的具體用法?Java CompareOp.GREATER怎麽用?Java CompareOp.GREATER使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.apache.hadoop.hbase.filter.CompareFilter.CompareOp的用法示例。


在下文中一共展示了CompareOp.GREATER屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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];
    }
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:26,代碼來源:Range.java

示例2: 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");
 }
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:23,代碼來源:ParseFilter.java

示例3: testFilterWithLongCompartor

@Test
  public void testFilterWithLongCompartor() throws Exception {
    byte [] TABLE = Bytes.toBytes("testFilterWithLongCompartor");
    Table ht = TEST_UTIL.createTable(TABLE, FAMILY);
    byte [][] ROWS = makeN(ROW, 10);
    byte [][] values = new byte[10][];
    for (int i = 0; i < 10; i ++) {
        values[i] = Bytes.toBytes(100L * i);
    }
    for(int i = 0; i < 10; i ++) {
      Put put = new Put(ROWS[i]);
      put.setDurability(Durability.SKIP_WAL);
      put.add(FAMILY, QUALIFIER, values[i]);
      ht.put(put);
    }
    Scan scan = new Scan();
    scan.addFamily(FAMILY);
    Filter filter = new SingleColumnValueFilter(FAMILY, QUALIFIER, CompareOp.GREATER,
      new LongComparator(500));
    scan.setFilter(filter);
    ResultScanner scanner = ht.getScanner(scan);
    int expectedIndex = 0;
    for(Result result : ht.getScanner(scan)) {
      assertEquals(result.size(), 1);
      assertTrue(Bytes.toLong(result.getValue(FAMILY, QUALIFIER)) > 500);
      expectedIndex++;
    }
    assertEquals(expectedIndex, 4);
    scanner.close();
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:30,代碼來源:TestFromClientSide.java

示例4: 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;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:12,代碼來源:Range.java

示例5: setStartType

/**
 * Set start type for start value.
 *
 * @param startType - can only be EQUAL, GREATER or GREATER_OR_EQUAL
 */
public void setStartType(CompareOp startType) {
  if (startType == CompareOp.EQUAL || startType == CompareOp.GREATER
      || startType == CompareOp.GREATER_OR_EQUAL) {
    this.startType = startType;
  } else {
    this.startType = startType;
    //			throw new IllegalArgumentException("Illegal start type: "
    //					+ startType.toString());
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:15,代碼來源:Range.java

示例6: getOpsite

public Range getOpsite() {
  Range ran = new Range();
  ran.column = this.column;
  ran.valueType = this.valueType;
  ran.startValue = this.endValue;
  ran.endValue = this.startValue;
  ran.setStartTs(startTs);
  ran.setEndTs(endTs);
  ran.setLatestVersionOnly(latestVersionOnly);
  ran.setFilterIfMissing(filterIfMissing);

  if (ran.valueType == DataType.BOOLEAN) {
    if (Bytes.toString(this.startValue).equals("true")) {
      ran.startValue = Bytes.toBytes("false");
    } else if (Bytes.toString(this.startValue).equals("false")) {
      ran.startValue = Bytes.toBytes("true");
    }
    ran.startType = CompareOp.EQUAL;
    return ran;
  }
  if (this.startValue != null && this.startValue.length != 0) {
    switch (this.startType) {
    case EQUAL:
      ran.startType = CompareOp.GREATER;
      ran.startValue = this.startValue;
      ran.endValue = this.startValue;
      ran.endType = CompareOp.LESS;
      break;
    case GREATER_OR_EQUAL:
      ran.endType = CompareOp.LESS;
      break;
    case GREATER:
      ran.endType = CompareOp.LESS_OR_EQUAL;
      break;
    default:
      break;
    }
  }
  if (this.endValue != null && this.endValue.length != 0) {
    switch (this.endType) {
    case LESS:
      ran.startType = CompareOp.GREATER_OR_EQUAL;
      break;
    case LESS_OR_EQUAL:
      ran.startType = CompareOp.GREATER;
      break;
    default:
      break;
    }
  }

  return ran;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:53,代碼來源:Range.java


注:本文中的org.apache.hadoop.hbase.filter.CompareFilter.CompareOp.GREATER屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。