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


Java Increment.getTimeRange方法代碼示例

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


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

示例1: getIncrementCurrentValue

import org.apache.hadoop.hbase.client.Increment; //導入方法依賴的package包/類
/**
 * Do a specific Get on passed <code>columnFamily</code> and column qualifiers from
 * <code>incrementCoordinates</code> only.
 *
 * @param increment
 * @param columnFamily
 * @param increments
 * @return Return the Cells to Increment
 * @throws IOException
 */
private List<Cell> getIncrementCurrentValue(final Increment increment, byte[] columnFamily,
    final List<Cell> increments, final IsolationLevel isolation) throws IOException {
  Get get = new Get(increment.getRow());
  if (isolation != null) get.setIsolationLevel(isolation);
  for (Cell cell : increments) {
    get.addColumn(columnFamily, CellUtil.cloneQualifier(cell));
  }
  TimeRange tr = increment.getTimeRange();
  if (tr != null) {
    get.setTimeRange(tr.getMin(), tr.getMax());
  }
  return get(get, false);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:24,代碼來源:HRegion.java

示例2: toMutation

import org.apache.hadoop.hbase.client.Increment; //導入方法依賴的package包/類
/**
 * Convert a client Increment to a protobuf Mutate.
 *
 * @param increment
 * @return the converted mutate
 */
public static MutationProto toMutation(
  final Increment increment, final MutationProto.Builder builder, long nonce) {
  builder.setRow(ByteStringer.wrap(increment.getRow()));
  builder.setMutateType(MutationType.INCREMENT);
  builder.setDurability(toDurability(increment.getDurability()));
  if (nonce != HConstants.NO_NONCE) {
    builder.setNonce(nonce);
  }
  TimeRange timeRange = increment.getTimeRange();
  if (!timeRange.isAllTime()) {
    HBaseProtos.TimeRange.Builder timeRangeBuilder =
      HBaseProtos.TimeRange.newBuilder();
    timeRangeBuilder.setFrom(timeRange.getMin());
    timeRangeBuilder.setTo(timeRange.getMax());
    builder.setTimeRange(timeRangeBuilder.build());
  }
  ColumnValue.Builder columnBuilder = ColumnValue.newBuilder();
  QualifierValue.Builder valueBuilder = QualifierValue.newBuilder();
  for (Map.Entry<byte[], List<Cell>> family: increment.getFamilyCellMap().entrySet()) {
    columnBuilder.setFamily(ByteStringer.wrap(family.getKey()));
    columnBuilder.clearQualifierValue();
    List<Cell> values = family.getValue();
    if (values != null && values.size() > 0) {
      for (Cell cell: values) {
        valueBuilder.clear();
        valueBuilder.setQualifier(ByteStringer.wrap(
            cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()));
        valueBuilder.setValue(ByteStringer.wrap(
            cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()));
        if (cell.getTagsLength() > 0) {
          valueBuilder.setTags(ByteStringer.wrap(cell.getTagsArray(),
              cell.getTagsOffset(), cell.getTagsLength()));
        }
        columnBuilder.addQualifierValue(valueBuilder.build());
      }
    }
    builder.addColumnValue(columnBuilder.build());
  }
  Map<String, byte[]> attributes = increment.getAttributesMap();
  if (!attributes.isEmpty()) {
    NameBytesPair.Builder attributeBuilder = NameBytesPair.newBuilder();
    for (Map.Entry<String, byte[]> attribute : attributes.entrySet()) {
      attributeBuilder.setName(attribute.getKey());
      attributeBuilder.setValue(ByteStringer.wrap(attribute.getValue()));
      builder.addAttribute(attributeBuilder.build());
    }
  }
  return builder.build();
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:56,代碼來源:ProtobufUtil.java

示例3: toMutation

import org.apache.hadoop.hbase.client.Increment; //導入方法依賴的package包/類
/**
 * Convert a client Increment to a protobuf Mutate.
 *
 * @param increment
 * @return the converted mutate
 */
public static MutationProto toMutation(
  final Increment increment, final MutationProto.Builder builder, long nonce) {
  builder.setRow(HBaseZeroCopyByteString.wrap(increment.getRow()));
  builder.setMutateType(MutationType.INCREMENT);
  builder.setDurability(toDurability(increment.getDurability()));
  if (nonce != HConstants.NO_NONCE) {
    builder.setNonce(nonce);
  }
  TimeRange timeRange = increment.getTimeRange();
  if (!timeRange.isAllTime()) {
    HBaseProtos.TimeRange.Builder timeRangeBuilder =
      HBaseProtos.TimeRange.newBuilder();
    timeRangeBuilder.setFrom(timeRange.getMin());
    timeRangeBuilder.setTo(timeRange.getMax());
    builder.setTimeRange(timeRangeBuilder.build());
  }
  ColumnValue.Builder columnBuilder = ColumnValue.newBuilder();
  QualifierValue.Builder valueBuilder = QualifierValue.newBuilder();
  for (Map.Entry<byte[], List<Cell>> family: increment.getFamilyCellMap().entrySet()) {
    columnBuilder.setFamily(HBaseZeroCopyByteString.wrap(family.getKey()));
    columnBuilder.clearQualifierValue();
    List<Cell> values = family.getValue();
    if (values != null && values.size() > 0) {
      for (Cell cell: values) {
        KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
        valueBuilder.setQualifier(HBaseZeroCopyByteString.wrap(
            kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength()));
        valueBuilder.setValue(HBaseZeroCopyByteString.wrap(
            kv.getValueArray(), kv.getValueOffset(), kv.getValueLength()));
        if (kv.getTagsLength() > 0) {
          valueBuilder.setTags(HBaseZeroCopyByteString.wrap(kv.getTagsArray(),
              kv.getTagsOffset(), kv.getTagsLength()));
        }
        columnBuilder.addQualifierValue(valueBuilder.build());
      }
    }
    builder.addColumnValue(columnBuilder.build());
  }
  Map<String, byte[]> attributes = increment.getAttributesMap();
  if (!attributes.isEmpty()) {
    NameBytesPair.Builder attributeBuilder = NameBytesPair.newBuilder();
    for (Map.Entry<String, byte[]> attribute : attributes.entrySet()) {
      attributeBuilder.setName(attribute.getKey());
      attributeBuilder.setValue(HBaseZeroCopyByteString.wrap(attribute.getValue()));
      builder.addAttribute(attributeBuilder.build());
    }
  }
  return builder.build();
}
 
開發者ID:tenggyut,項目名稱:HIndex,代碼行數:56,代碼來源:ProtobufUtil.java


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