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


Java Get.setTimeStamp方法代碼示例

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


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

示例1: assertResultEquals

import org.apache.hadoop.hbase.client.Get; //導入方法依賴的package包/類
protected void assertResultEquals(final HRegion region, final byte [] row,
  final byte [] family, final byte [] qualifier, final long timestamp,
  final byte [] value)
throws IOException {
  Get get = new Get(row);
  get.setTimeStamp(timestamp);
  Result res = region.get(get);
  NavigableMap<byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>> map =
    res.getMap();
  byte [] res_value = map.get(family).get(qualifier).get(timestamp);

  if (value == null) {
    assertEquals(Bytes.toString(family) + " " + Bytes.toString(qualifier) +
        " at timestamp " + timestamp, null, res_value);
  } else {
    if (res_value == null) {
      fail(Bytes.toString(family) + " " + Bytes.toString(qualifier) +
          " at timestamp " + timestamp + "\" was expected to be \"" +
          Bytes.toStringBinary(value) + " but was null");
    }
    if (res_value != null) {
      assertEquals(Bytes.toString(family) + " " + Bytes.toString(qualifier) +
          " at timestamp " +
          timestamp, value, new String(res_value));
    }
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:28,代碼來源:HBaseTestCase.java

示例2: getFromThrift

import org.apache.hadoop.hbase.client.Get; //導入方法依賴的package包/類
/**
 * Creates a {@link Get} (HBase) from a {@link TGet} (Thrift).
 *
 * This ignores any timestamps set on {@link TColumn} objects.
 *
 * @param in the <code>TGet</code> to convert
 *
 * @return <code>Get</code> object
 *
 * @throws IOException if an invalid time range or max version parameter is given
 */
public static Get getFromThrift(TGet in) throws IOException {
  Get out = new Get(in.getRow());

  // Timestamp overwrites time range if both are set
  if (in.isSetTimestamp()) {
    out.setTimeStamp(in.getTimestamp());
  } else if (in.isSetTimeRange()) {
    out.setTimeRange(in.getTimeRange().getMinStamp(), in.getTimeRange().getMaxStamp());
  }

  if (in.isSetMaxVersions()) {
    out.setMaxVersions(in.getMaxVersions());
  }

  if (in.isSetFilterString()) {
    ParseFilter parseFilter = new ParseFilter();
    out.setFilter(parseFilter.parseFilterString(in.getFilterString()));
  }

  if (in.isSetAttributes()) {
    addAttributes(out,in.getAttributes());
  }

  if (in.isSetAuthorizations()) {
    out.setAuthorizations(new Authorizations(in.getAuthorizations().getLabels()));
  }
  
  if (!in.isSetColumns()) {
    return out;
  }

  for (TColumn column : in.getColumns()) {
    if (column.isSetQualifier()) {
      out.addColumn(column.getFamily(), column.getQualifier());
    } else {
      out.addFamily(column.getFamily());
    }
  }

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


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