我想从特定 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.
我想从特定 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.
这很简单。你试过什么吗?无论如何,
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();