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


Java CellUtil.isDelete方法代碼示例

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


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

示例1: checkVersion

import org.apache.hadoop.hbase.CellUtil; //導入方法依賴的package包/類
/**
 * Check whether this version should be retained.
 * There are 4 variables considered:
 * If this version is past max versions -> skip it
 * If this kv has expired or was deleted, check min versions
 * to decide whther to skip it or not.
 *
 * Increase the version counter unless this is a delete
 */
private MatchCode checkVersion(byte type, long timestamp) {
  if (!CellUtil.isDelete(type)) {
    currentCount++;
  }
  if (currentCount > maxVersions) {
    return ScanQueryMatcher.MatchCode.SEEK_NEXT_COL; // skip to next col
  }
  // keep the KV if required by minversions or it is not expired, yet
  if (currentCount <= minVersions || !isExpired(timestamp)) {
    setTSAndType(timestamp, type);
    return ScanQueryMatcher.MatchCode.INCLUDE;
  } else {
    return MatchCode.SEEK_NEXT_COL;
  }

}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:26,代碼來源:ScanWildcardColumnTracker.java

示例2: countDeleteMarkers

import org.apache.hadoop.hbase.CellUtil; //導入方法依賴的package包/類
private int countDeleteMarkers(Region region) throws IOException {
  Scan s = new Scan();
  s.setRaw(true);
  // use max versions from the store(s)
  s.setMaxVersions(region.getStores().iterator().next().getScanInfo().getMaxVersions());
  InternalScanner scan = region.getScanner(s);
  List<Cell> kvs = new ArrayList<Cell>();
  int res = 0;
  boolean hasMore;
  do {
    hasMore = scan.next(kvs);
    for (Cell kv : kvs) {
      if(CellUtil.isDelete(kv)) res++;
    }
    kvs.clear();
  } while (hasMore);
  scan.close();
  return res;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:20,代碼來源:TestKeepDeletes.java

示例3: addDeleteMarker

import org.apache.hadoop.hbase.CellUtil; //導入方法依賴的package包/類
/**
 * Advanced use only.
 * Add an existing delete marker to this Delete object.
 * @param kv An existing KeyValue of type "delete".
 * @return this for invocation chaining
 * @throws IOException
 */
@SuppressWarnings("unchecked")
public Delete addDeleteMarker(Cell kv) throws IOException {
  // TODO: Deprecate and rename 'add' so it matches how we add KVs to Puts.
  if (!CellUtil.isDelete(kv)) {
    throw new IOException("The recently added KeyValue is not of type "
        + "delete. Rowkey: " + Bytes.toStringBinary(this.row));
  }
  if (Bytes.compareTo(this.row, 0, row.length, kv.getRowArray(),
      kv.getRowOffset(), kv.getRowLength()) != 0) {
    throw new WrongRowIOException("The row in " + kv.toString() +
      " doesn't match the original one " +  Bytes.toStringBinary(this.row));
  }
  byte [] family = CellUtil.cloneFamily(kv);
  List<Cell> list = familyMap.get(family);
  if (list == null) {
    list = new ArrayList<Cell>();
  }
  list.add(kv);
  familyMap.put(family, list);
  return this;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:29,代碼來源:Delete.java

示例4: toMutation

import org.apache.hadoop.hbase.CellUtil; //導入方法依賴的package包/類
public static MutationProto toMutation(final MutationType type, final Mutation mutation,
    MutationProto.Builder builder, long nonce)
throws IOException {
  builder = getMutationBuilderAndSetCommonFields(type, mutation, builder);
  if (nonce != HConstants.NO_NONCE) {
    builder.setNonce(nonce);
  }
  ColumnValue.Builder columnBuilder = ColumnValue.newBuilder();
  QualifierValue.Builder valueBuilder = QualifierValue.newBuilder();
  for (Map.Entry<byte[],List<Cell>> family: mutation.getFamilyCellMap().entrySet()) {
    columnBuilder.clear();
    columnBuilder.setFamily(ByteStringer.wrap(family.getKey()));
    for (Cell cell: family.getValue()) {
      valueBuilder.clear();
      valueBuilder.setQualifier(ByteStringer.wrap(
          cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()));
      valueBuilder.setValue(ByteStringer.wrap(
          cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()));
      valueBuilder.setTimestamp(cell.getTimestamp());
      if (type == MutationType.DELETE || (type == MutationType.PUT && CellUtil.isDelete(cell))) {
        KeyValue.Type keyValueType = KeyValue.Type.codeToType(cell.getTypeByte());
        valueBuilder.setDeleteType(toDeleteType(keyValueType));
      }
      columnBuilder.addQualifierValue(valueBuilder.build());
    }
    builder.addColumnValue(columnBuilder.build());
  }
  return builder.build();
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:30,代碼來源:ProtobufUtil.java


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