本文主要是介绍hbase KeyValue结构打印,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一、表内容
hbase(main):003:0> scan ‘tableCreateTest1’
ROW | COLUMN+CELL |
---|---|
row1 | column=cf1:name, timestamp=1467639285495, value=zq |
1 row(s) in 0.0210 seconds
二、KeyValue
1.片段代码
Get get = new Get(Bytes.toBytes("row1"));
try {Result rs = ht.get(get);System.out.println("result size: " + rs.size());System.out.println("result.toString: " + rs.toString());KeyValue kv = rs.getColumnLatest(Bytes.toBytes("cf1"), Bytes.toBytes("name"));System.out.println("kv key: " + Bytes.toString(kv.getKey()));System.out.println("kv key: " + kv.getKeyString());System.out.println("kv key: " + KeyValue.keyToString(kv.getKey()));System.out.println("kv row: " + Bytes.toString(kv.getRow()));System.out.println("kv family: " + Bytes.toString(kv.getFamily()));System.out.println("kv qualifier: " + Bytes.toString(kv.getQualifier()));System.out.println("kv timestam: " + String.valueOf(kv.getTimestamp()));System.out.println("kv value: " + Bytes.toString(kv.getValue()));
} catch (IOException e) {e.printStackTrace();
}
2.结果
result size: 1
result.toString: keyvalues={row1/cf1:name/1467639285495/Put/vlen=2/mvcc=0}kv key: row1cf1nameU�F�
kv key:\x00\x04row1\x03cf1name\x00\x00\x01U\xB61\x1B\xF1\x04
kv key: row1/cf1:name/1467639285495/Put
kv row: row1
kv family: cf1
kv qualifier: name
kv timestam: 1467639285495
kv value: zq
这篇关于hbase KeyValue结构打印的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!