[英]how to get the row key from hbase scan result
when scan the hbase table row by row, how can i get the row key? 当逐行扫描hbase表时,如何获得行键? here is my code:
这是我的代码:
for (Result rr : scanner) {
System.out.println(rr);
}
is there any method like getKey() that i can use? 有没有像我可以使用的getKey()方法? thanks.
谢谢。
If you want the row key in a string format, use the getRow
and the Bytes.toString
methods : 如果您希望以字符串格式使用行键,请使用
getRow
和Bytes.toString
方法:
for (Result rr : scanner) {
String key = Bytes.toString(rr.getRow())
}
HBase API - Result object HBase API - 结果对象
getRow()
Method for retrieving the row key that corresponds to the row from which this Result was created. getRow()
用于检索与创建此Result的行对应的行键的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.