下面列出了org.apache.hadoop.hbase.client.Result#value ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@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();
}
}
/** 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);
}
@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);
}
private byte[] getMergedStats(final Result result, final boolean clientsideStatsMerge) {
if (!clientsideStatsMerge || (result.size() == 1)) {
return result.value();
}
return URLClassloaderUtils.toBinary(HBaseUtils.getMergedStats(result.listCells()));
}