Java Code Examples for org.apache.hadoop.hbase.client.Result#value()

The following examples show how to use org.apache.hadoop.hbase.client.Result#value() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: splicer   File: MetricsCache.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public byte[] load(String metric) throws Exception {
	Configuration config = regionUtil.getConfig();
	try (HTable table = new HTable(config, "tsdb-uid")) {
		Get get = new Get(toBytes(metric));
		get.addColumn(toBytes("id"), toBytes("metrics"));
		Result result = table.get(get);
		LOG.info("Looking up key for metric={}. Found result={}",
				metric, Arrays.toString(result.value()));
		return result.value();
	}
}
 
Example 2
Source Project: hbase   File: TestScanner.java    License: Apache License 2.0 5 votes vote down vote up
/** Use get to retrieve the HRegionInfo and validate it */
private void getRegionInfo(Table table) throws IOException {
  Get get = new Get(ROW_KEY);
  get.addColumn(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER);
  Result result = table.get(get);
  byte [] bytes = result.value();
  validateRegionInfo(bytes);
}
 
Example 3
Source Project: pinpoint   File: HostApplicationMapper.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Application mapRow(Result result, int rowNum) throws Exception {
    if (result.isEmpty()) {
        return null;
    }
    byte[] value = result.value();

    if (value.length != HbaseTableConstatns.APPLICATION_NAME_MAX_LEN + 2) {
        logger.warn("Invalid value. {}", Arrays.toString(value));
    }

    String applicationName = Bytes.toString(value, 0, HbaseTableConstatns.APPLICATION_NAME_MAX_LEN - 1).trim();
    short serviceTypeCode = Bytes.toShort(value, HbaseTableConstatns.APPLICATION_NAME_MAX_LEN);
    return this.applicationFactory.createApplication(applicationName, serviceTypeCode);
}
 
Example 4
Source Project: geowave   File: HBaseMetadataReader.java    License: Apache License 2.0 5 votes vote down vote up
private byte[] getMergedStats(final Result result, final boolean clientsideStatsMerge) {
  if (!clientsideStatsMerge || (result.size() == 1)) {
    return result.value();
  }

  return URLClassloaderUtils.toBinary(HBaseUtils.getMergedStats(result.listCells()));
}