HBase scan with multiple versions

HBase support multiple versions of data, when modifying a value, new version will be saved with timestamp.

Scan with versions

This will scan the table and number of versions is 4

Scan with versions and time range

We can also filter versions data further by time range.

HBase get column qualifiers by column family

To get column qualifiers by column family we can use following code

Above code will outputs all column qualifer names of family map "basicInfo" in table "merchants".

 

And following code shows different ways to retrieve HBase cell value

 

  • Get Cell by Family Map and Column Qualifier

This line of code retrives cell value by family map "merchantNo" and column qualifier "string"

 

  • Get All Cells by Faimily Map

result.getFamilyMap(Bytes.toBytes("merchantNo"))  will return column family map with name "merchantNo", it contains column qualifier name as key and cell value as value.

Above code will iterate the column family map, and outputs each column qualifier and its corresponding cell value.