2013-05-14 2 views
0

특정 Rowkey 내에서 Hbase 테이블의 모든 열을 가져오고 싶습니다.특정 행 키의 Hbase 스캔

eg: 
Rowkey starts from 123456 
Rowkey ends with 123466 

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

답변

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();  
+0

감사합니다. Tariq :) –

관련 문제