retrieving multiple versions through API through hbase
Posted
by sammy
on Stack Overflow
See other posts from Stack Overflow
or by sammy
Published on 2010-06-13T11:28:32Z
Indexed on
2010/06/13
11:32 UTC
Read the original article
Hit count: 287
hello , this is a continuation of my previous question where id used hbase shell.. http://stackoverflow.com/questions/3024417/facing-problems-while-updating-rows-in-hbase
i tried the same with API..
im not able to figure out how to retrieve all versions , iterate and print their values for a specific row... i've spending hours reading... please help me out...
Scan s = new Scan(Bytes.toBytes("row1"));
s.addColumn(Bytes.toBytes("column"),Bytes.toBytes("address"));
SETTING RANGE FOR THE VERSIONS
s.setTimeRange(0L,6L);
ResultScanner scanner = table.getScanner(s);
for (Result r : scanner) {
for(KeyValue kv : r.sorted()) {
System.out.println("To"+kv.getTimestamp());
System.out.println("from "+Bytes.toString(kv.getKey()));
System.out.println("To "+Bytes.toString(kv.getValue()));
}
scanner.close();
}
here im intending to print all versions of the column..... but it gives the most recent one...
im stuck here...
© Stack Overflow or respective owner