org.apache.hadoop.hbase.client.Get.readVersions()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(122)

本文整理了Java中org.apache.hadoop.hbase.client.Get.readVersions()方法的一些代码示例,展示了Get.readVersions()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Get.readVersions()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Get
类名称:Get
方法名:readVersions

Get.readVersions介绍

[英]Get up to the specified number of versions of each column.
[中]获取每个列的指定版本数。

代码示例

代码示例来源:origin: apache/hbase

/**
 * Get up to the specified number of versions of each column.
 * @param maxVersions maximum versions for each column
 * @throws IOException if invalid number of versions
 * @return this for invocation chaining
 * @deprecated It is easy to misunderstand with column family's max versions, so use
 *             {@link #readVersions(int)} instead.
 */
@Deprecated
public Get setMaxVersions(int maxVersions) throws IOException {
 return readVersions(maxVersions);
}

代码示例来源:origin: apache/hbase

@Override
public void preGetOp(ObserverContext<RegionCoprocessorEnvironment> c, Get get,
  List<Cell> result) throws IOException {
 TableName tableName = c.getEnvironment().getRegion().getTableDescriptor().getTableName();
 Long ttl = this.ttls.get(tableName);
 if (ttl != null) {
  get.setTimeRange(EnvironmentEdgeManager.currentTime() - ttl, get.getTimeRange().getMax());
 }
 Integer version = this.versions.get(tableName);
 if (version != null) {
  get.readVersions(version);
 }
}

代码示例来源:origin: org.apache.hbase/hbase-client

/**
 * Get up to the specified number of versions of each column.
 * @param maxVersions maximum versions for each column
 * @throws IOException if invalid number of versions
 * @return this for invocation chaining
 * @deprecated It is easy to misunderstand with column family's max versions, so use
 *             {@link #readVersions(int)} instead.
 */
@Deprecated
public Get setMaxVersions(int maxVersions) throws IOException {
 return readVersions(maxVersions);
}

代码示例来源:origin: apache/hbase

Result result = r.get(new Get(STARTROW).addFamily(COLUMN_FAMILY_TEXT).readVersions(100));
assertEquals(compactionThreshold, result.size());
result = r.get(new Get(secondRowBytes).addFamily(COLUMN_FAMILY_TEXT).readVersions(100));
LOG.debug("Row " + Bytes.toStringBinary(secondRowBytes) + " after " +
  "initial compaction: " + result);
result = r.get(new Get(secondRowBytes).addFamily(COLUMN_FAMILY_TEXT).readVersions(100));
assertTrue("Second row should have been deleted", result.isEmpty());
result = r.get(new Get(secondRowBytes).addFamily(COLUMN_FAMILY_TEXT).readVersions(100));
assertTrue("Second row should have been deleted", result.isEmpty());
r.flush(true);
result = r.get(new Get(secondRowBytes).addFamily(COLUMN_FAMILY_TEXT).readVersions(100));
assertTrue("Second row should still be deleted", result.isEmpty());
assertEquals(1, r.getStore(COLUMN_FAMILY_TEXT).getStorefiles().size());
result = r.get(new Get(secondRowBytes).addFamily(COLUMN_FAMILY_TEXT).readVersions(100));
assertTrue("Second row should still be deleted", result.isEmpty());

代码示例来源:origin: apache/hbase

g.readVersions(10);
Result r = t.get(g);
assertEquals(3, r.size());

代码示例来源:origin: com.aliyun.hbase/alihbase-client

/**
 * Get up to the specified number of versions of each column.
 * @param maxVersions maximum versions for each column
 * @throws IOException if invalid number of versions
 * @return this for invocation chaining
 * @deprecated It is easy to misunderstand with column family's max versions, so use
 *             {@link #readVersions(int)} instead.
 */
@Deprecated
public Get setMaxVersions(int maxVersions) throws IOException {
 return readVersions(maxVersions);
}

代码示例来源:origin: gojektech/feast

/**
 * Create list of BigTable's Get operation.
 *
 * @param entityIds list of entity ID.
 * @param featureIdBytes byte array value of a feature ID.
 * @param columnFamily byte array value of column family
 * @return list of Get operation.
 */
private List<Get> createGets(
  Collection<String> entityIds, byte[] featureIdBytes, byte[] columnFamily) {
 List<Get> gets = new ArrayList<>();
 for (String entityId : entityIds) {
  String entityIdPrefix = DigestUtils.sha1Hex(entityId.getBytes()).substring(0, 7);
  BigTableRowKey btKey = createRowKey(entityIdPrefix, entityId, "0");
  Get get = new Get(btKey.toByteArray());
  get.addColumn(columnFamily, featureIdBytes);
  try {
   // for some reason Get.readVersions has checked exception.
   get.readVersions(1);
  } catch (IOException e) {
   log.error("should not happen");
  }
  gets.add(get);
 }
 return gets;
}

代码示例来源:origin: org.apache.hbase/hbase-server

@Override
public void preGetOp(ObserverContext<RegionCoprocessorEnvironment> c, Get get,
  List<Cell> result) throws IOException {
 TableName tableName = c.getEnvironment().getRegion().getTableDescriptor().getTableName();
 Long ttl = this.ttls.get(tableName);
 if (ttl != null) {
  get.setTimeRange(EnvironmentEdgeManager.currentTime() - ttl, get.getTimeRange().getMax());
 }
 Integer version = this.versions.get(tableName);
 if (version != null) {
  get.readVersions(version);
 }
}

代码示例来源:origin: org.apache.hbase/hbase-server

Result result = r.get(new Get(STARTROW).addFamily(COLUMN_FAMILY_TEXT).readVersions(100));
assertEquals(compactionThreshold, result.size());
result = r.get(new Get(secondRowBytes).addFamily(COLUMN_FAMILY_TEXT).readVersions(100));
LOG.debug("Row " + Bytes.toStringBinary(secondRowBytes) + " after " +
  "initial compaction: " + result);
result = r.get(new Get(secondRowBytes).addFamily(COLUMN_FAMILY_TEXT).readVersions(100));
assertTrue("Second row should have been deleted", result.isEmpty());
result = r.get(new Get(secondRowBytes).addFamily(COLUMN_FAMILY_TEXT).readVersions(100));
assertTrue("Second row should have been deleted", result.isEmpty());
r.flush(true);
result = r.get(new Get(secondRowBytes).addFamily(COLUMN_FAMILY_TEXT).readVersions(100));
assertTrue("Second row should still be deleted", result.isEmpty());
assertEquals(1, r.getStore(COLUMN_FAMILY_TEXT).getStorefiles().size());
result = r.get(new Get(secondRowBytes).addFamily(COLUMN_FAMILY_TEXT).readVersions(100));
assertTrue("Second row should still be deleted", result.isEmpty());

代码示例来源:origin: org.apache.hbase/hbase-server

g.readVersions(10);
Result r = t.get(g);
assertEquals(3, r.size());

相关文章