简体   繁体   中英

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? here is my code:

for (Result rr : scanner) {
   System.out.println(rr);
}

is there any method like getKey() that i can use? thanks.

If you want the row key in a string format, use the getRow and the Bytes.toString methods :

for (Result rr : scanner) {
   String key = Bytes.toString(rr.getRow())
}

HBase API - Result object

getRow() Method for retrieving the row key that corresponds to the row from which this Result was created.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM