当前位置: 首页>>代码示例>>Java>>正文


Java Put.getTimeStamp方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.client.Put.getTimeStamp方法的典型用法代码示例。如果您正苦于以下问题:Java Put.getTimeStamp方法的具体用法?Java Put.getTimeStamp怎么用?Java Put.getTimeStamp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.client.Put的用法示例。


在下文中一共展示了Put.getTimeStamp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processPut

import org.apache.hadoop.hbase.client.Put; //导入方法依赖的package包/类
/**
 * parse put, add index put into mdRecordList
 */
private void processPut(List<KeyValue> mdRecordList, Put put) throws IOException {
  if (put == null) return;
  byte[] rawRowkey = put.getRow();
  int[] arr = new int[dimensions];
  int i = 0;
  for (Map.Entry<byte[], TreeSet<byte[]>> entry : tableRelation.getIndexFamilyMap().entrySet()) {
    for (byte[] qualifier : entry.getValue()) {
      arr[i] = Bytes.toInt(put.get(entry.getKey(), qualifier).get(0).getValue());
      ++i;
    }
  }
  byte[] mdKey = MDUtils.bitwiseZip(arr, dimensions);
  KeyValue keyValue =
      new KeyValue(mdKey, LMDIndexConstants.FAMILY, rawRowkey, put.getTimeStamp(), Type.Put,
          LMDIndexConstants.VALUE);
  mdRecordList.add(keyValue);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:LMDIndexWriter.java

示例2: buildModelFromPut

import org.apache.hadoop.hbase.client.Put; //导入方法依赖的package包/类
protected CellSetModel buildModelFromPut(Put put) {
  RowModel row = new RowModel(put.getRow());
  long ts = put.getTimeStamp();
  for (List<Cell> cells: put.getFamilyCellMap().values()) {
    for (Cell cell: cells) {
      row.addCell(new CellModel(CellUtil.cloneFamily(cell), CellUtil.cloneQualifier(cell),
        ts != HConstants.LATEST_TIMESTAMP ? ts : cell.getTimestamp(),
        CellUtil.cloneValue(cell)));
    }
  }
  CellSetModel model = new CellSetModel();
  model.addRow(row);
  return model;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:15,代码来源:RemoteHTable.java

示例3: testPut

import org.apache.hadoop.hbase.client.Put; //导入方法依赖的package包/类
/**
 * Test Put Mutate conversions.
 *
 * @throws IOException
 */
@Test
public void testPut() throws IOException {
  MutationProto.Builder mutateBuilder = MutationProto.newBuilder();
  mutateBuilder.setRow(ByteString.copyFromUtf8("row"));
  mutateBuilder.setMutateType(MutationType.PUT);
  mutateBuilder.setTimestamp(111111);
  ColumnValue.Builder valueBuilder = ColumnValue.newBuilder();
  valueBuilder.setFamily(ByteString.copyFromUtf8("f1"));
  QualifierValue.Builder qualifierBuilder = QualifierValue.newBuilder();
  qualifierBuilder.setQualifier(ByteString.copyFromUtf8("c1"));
  qualifierBuilder.setValue(ByteString.copyFromUtf8("v1"));
  valueBuilder.addQualifierValue(qualifierBuilder.build());
  qualifierBuilder.setQualifier(ByteString.copyFromUtf8("c2"));
  qualifierBuilder.setValue(ByteString.copyFromUtf8("v2"));
  qualifierBuilder.setTimestamp(222222);
  valueBuilder.addQualifierValue(qualifierBuilder.build());
  mutateBuilder.addColumnValue(valueBuilder.build());

  MutationProto proto = mutateBuilder.build();
  // default fields
  assertEquals(MutationProto.Durability.USE_DEFAULT, proto.getDurability());

  // set the default value for equal comparison
  mutateBuilder = MutationProto.newBuilder(proto);
  mutateBuilder.setDurability(MutationProto.Durability.USE_DEFAULT);

  Put put = ProtobufUtil.toPut(proto);

  // put value always use the default timestamp if no
  // value level timestamp specified,
  // add the timestamp to the original mutate
  long timestamp = put.getTimeStamp();
  for (ColumnValue.Builder column:
      mutateBuilder.getColumnValueBuilderList()) {
    for (QualifierValue.Builder qualifier:
        column.getQualifierValueBuilderList()) {
      if (!qualifier.hasTimestamp()) {
        qualifier.setTimestamp(timestamp);
      }
    }
  }
  assertEquals(mutateBuilder.build(),
    ProtobufUtil.toMutation(MutationType.PUT, put));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:50,代码来源:TestProtobufUtil.java


注:本文中的org.apache.hadoop.hbase.client.Put.getTimeStamp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。