本文整理汇总了Java中org.apache.hadoop.hbase.client.Result.getFamilyMap方法的典型用法代码示例。如果您正苦于以下问题:Java Result.getFamilyMap方法的具体用法?Java Result.getFamilyMap怎么用?Java Result.getFamilyMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.client.Result
的用法示例。
在下文中一共展示了Result.getFamilyMap方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseUserResult
import org.apache.hadoop.hbase.client.Result; //导入方法依赖的package包/类
protected static void parseUserResult(final String userName, final Result result,
final UserQuotasVisitor visitor) throws IOException {
Map<byte[], byte[]> familyMap = result.getFamilyMap(QUOTA_FAMILY_INFO);
if (familyMap == null || familyMap.isEmpty()) return;
for (Map.Entry<byte[], byte[]> entry : familyMap.entrySet()) {
Quotas quotas = quotasFromData(entry.getValue());
if (Bytes.startsWith(entry.getKey(), QUOTA_QUALIFIER_SETTINGS_PREFIX)) {
String name = Bytes.toString(entry.getKey(), QUOTA_QUALIFIER_SETTINGS_PREFIX.length);
if (name.charAt(name.length() - 1) == TableName.NAMESPACE_DELIM) {
String namespace = name.substring(0, name.length() - 1);
visitor.visitUserQuotas(userName, namespace, quotas);
} else {
TableName table = TableName.valueOf(name);
visitor.visitUserQuotas(userName, table, quotas);
}
} else if (Bytes.equals(entry.getKey(), QUOTA_QUALIFIER_SETTINGS)) {
visitor.visitUserQuotas(userName, quotas);
}
}
}
示例2: mapRow
import org.apache.hadoop.hbase.client.Result; //导入方法依赖的package包/类
@Override
public TraceAnnotationDto mapRow(Result res, int rowNum) throws Exception {
String rowKey = new String(res.getRow());
NavigableMap<byte[], byte[]> familyMap = res.getFamilyMap(TABLE_ANNOTATION_COLUMN_FAMILY.getBytes());
String[] ss = rowKey.split("_");
String iface = ss[0];
String method = ss[1];
String type = ss[2];
long timestamp = Long.parseLong(ss[3]);
String traceId = "", value = "";
for (Map.Entry<byte[], byte[]> entry : familyMap.entrySet()) {
traceId = new String(entry.getKey());
value = new String(entry.getValue());
}
TraceAnnotationDto tad = new TraceAnnotationDto();
tad.setRowKey(rowKey).setIface(iface).setMethod(method).setType(type).setTimestamp(timestamp);
tad.setTraceId(traceId).setValue(value);
return tad;
}
示例3: mapRow
import org.apache.hadoop.hbase.client.Result; //导入方法依赖的package包/类
@Override
public TraceDto mapRow(Result res, int rowNum) throws Exception {
String traceId = new String(res.getRow());
NavigableMap<byte[], byte[]> data = res.getFamilyMap(Constants.TABLE_TRACE_COLUMN_FAMILY.getBytes());
String spanId;
JSONObject spanDetail;
TreeMap<String, JSONObject> map = new TreeMap<>();
Set<Map.Entry<byte[], byte[]>> spanEntrySet = data.entrySet();
for (Map.Entry<byte[], byte[]> entry : spanEntrySet) {
spanId = new String(entry.getKey());
spanDetail = JSON.parseObject(new String(entry.getValue()));
map.put(spanId, spanDetail);
}
Set<Map.Entry<String, JSONObject>> spans = map.entrySet();
TraceDto rtn = new TraceDto();
rtn.setTraceId(traceId).setSpans(spans);
return rtn;
}
示例4: mapRow
import org.apache.hadoop.hbase.client.Result; //导入方法依赖的package包/类
@Override
public TraceTimeConsumeDto mapRow(Result res, int rowNum) throws Exception {
TraceTimeConsumeDto dto = new TraceTimeConsumeDto();
Map<byte[], byte[]> familyMap = res.getFamilyMap(Constants.TABLE_TIME_CONSUME_COLUMN_FAMILY.getBytes());
Set<Map.Entry<byte[], byte[]>> entrySet = familyMap.entrySet();
for (Map.Entry<byte[], byte[]> en : entrySet) {
dto.setTraceId(new String(en.getKey())).setConsumeTime(RadixUtil.bytesToLong(en.getValue()));
}
String[] ss = new String(res.getRow()).split(Constants.UNDER_LINE);
String iface = ss[0];
String method = ss[1];
Long startTime = Long.parseLong(ss[2]);
Long endTime = startTime + dto.getConsumeTime();
String rowKey = new String(res.getRow());
dto.setIface(iface).setMethod(method).setStartTime(startTime).setEndTime(endTime).setRowKey(rowKey);
return dto;
}
示例5: extractAuths
import org.apache.hadoop.hbase.client.Result; //导入方法依赖的package包/类
protected List<String> extractAuths(String user, List<Result> results) {
List<String> auths = new ArrayList<String>();
for (Result result : results) {
if (Bytes.equals(result.getRow(), Bytes.toBytes(user))) {
NavigableMap<byte[], byte[]> familyMap = result.getFamilyMap(LABELS_TABLE_FAMILY);
for (byte[] q : familyMap.keySet()) {
auths.add(Bytes.toString(q, 0, q.length));
}
}
}
return auths;
}
示例6: transformResultAndAddToList
import org.apache.hadoop.hbase.client.Result; //导入方法依赖的package包/类
private void transformResultAndAddToList(Result result, List<MDPoint> found) {
NavigableMap<byte[], byte[]> map = result.getFamilyMap(MDHBaseAdmin.SECONDARY_FAMILY);
if (map == null) return;
for (Entry<byte[], byte[]> entry : map.entrySet()) {
MDPoint p = toPoint(entry.getKey(), entry.getValue());
found.add(p);
}
}
示例7: checkResult
import org.apache.hadoop.hbase.client.Result; //导入方法依赖的package包/类
/**
* Verify that the result and key have expected values.
*
* @param r
* @param key
* @param expectedKey
* @param expectedValue
* @return
*/
static boolean checkResult(Result r, ImmutableBytesWritable key,
byte[] expectedKey, byte[] expectedValue) {
assertEquals(0, key.compareTo(expectedKey));
Map<byte[], byte[]> vals = r.getFamilyMap(FAMILY);
byte[] value = vals.values().iterator().next();
assertTrue(Arrays.equals(value, expectedValue));
return true; // if succeed
}
示例8: checkResult
import org.apache.hadoop.hbase.client.Result; //导入方法依赖的package包/类
/**
* Verify that the result and key have expected values.
*
* @param r
* @param key
* @param expectedKey
* @param expectedValue
* @return
*/
static boolean checkResult(Result r, ImmutableBytesWritable key,
byte[] expectedKey, byte[] expectedValue) {
assertEquals(0, key.compareTo(expectedKey));
Map<byte[], byte[]> vals = r.getFamilyMap(FAMILY);
byte[] value = vals.values().iterator().next();
assertTrue(Arrays.equals(value, expectedValue));
return true; // if succeed
}