0

我想从特定 Rowkey 中的 Hbase 表中获取所有列。

eg:
 Rowkey starts from 123456
 Rowkey ends with 123466

so i want to fetch programatically (In java) all columns  within this rowkeym only.
4

1 回答 1

1

这很简单。你试过什么吗?无论如何,

Configuration conf = HbaseConfiguration.create();
HTable table = new HTable(conf, "tablename");
Scan scan = new Scan();
scan.setStartRow(Bytes.toBytes("123456"));
scan.setStopRow(Bytes.toBytes("123456"));
ResultScanner rs = table.getScanner();
for (Result result : scanner) {
     for (KeyValue kv : result.raw()) {
        System.out.println("KV: " + kv + ", Value: " +
        Bytes.toString(kv.getValue()));
     }
}
scanner.close();    
于 2013-05-14T13:51:21.163 回答