Database Reference
In-Depth Information
Data can be retrieved from the HBase table by using the get command. As
mentioned earlier, the timestamp defaults to the milliseconds since January 1,
1970.
hbase> get 'my_table', '000700', 'cf2:cq3'
COLUMN CELL
cf2:cq3 timestamp=1393866138714, value=data3
1 row(s) in 0.0350 seconds
By default, the get command returns the most recent version. To illustrate, after
executing a second put operation in the same row and column, a subsequent get
provides the most recently added value of data4 .
hbase> put 'my_table', '000700', 'cf2:cq3', 'data4'
0 row(s) in 0.0040 seconds
hbase> get 'my_table', '000700', 'cf2:cq3'
COLUMN CELL
cf2:cq3 timestamp=1393866431669, value=data4
1 row(s) in 0.0080 seconds
The get operation can provide multiple versions by specifying the number of
versions to retrieve. This example illustrates that the cells are presented in
descending version order.
hbase> get 'my_table', '000700', {COLUMN => 'cf2:cq3',
VERSIONS => 2}
COLUMN CELL
cf2:cq3 timestamp=1393866431669, value=data4
cf2:cq3 timestamp=1393866138714, value=data3
2 row(s) in 1.0200 seconds
A similar operation to the get command is scan . A scan retrieves all the rows
between a specified STARTROW and a STOPROW , but excluding the STOPROW . Note:
if the STOPROW was set to 000700 , only row 000600 would have been returned.
Search WWH ::




Custom Search