2

I am trying to do the following command in hbase:

scan 'testLastVersion' {VERSIONS=>8}

And it return only the last version of the row.
Do you know how can I get all the versions of row through command shell and through java code? Thanks!

MosheCh
  • 99
  • 3
  • 12

1 Answers1

4

I think you are missing the ',' there.. The command should be something like this:

scan 'emp', {VERSIONS=>8}

Even if you are missing the comma, HBase should throw an error:

SyntaxError: (hbase):16: syntax error, unexpected tLCURLY

I tried to simulate a your scenario and got all the results. Please find them below.

hbase(main):010:0> put 'emp', '1', 'personal_data:name', 'Ajay'
0 row(s) in 0.0220 seconds
hbase(main):012:0> put 'emp', '1', 'personal_data:name', 'Vijay'
0 row(s) in 0.0140 seconds
hbase(main):014:0> put 'emp', '1', 'personal_data:name', 'Ceema'
0 row(s) in 0.0070 seconds

hbase(main):017:0> scan 'emp', {VERSIONS=>3}
ROW                                        COLUMN+CELL
 1                                         column=personal_data:name, timestamp=1472651320449, value=Ceema
 1                                         column=personal_data:name, timestamp=1472651313396, value=Vijay
 1                                         column=personal_data:name, timestamp=1472651300718, value=Ajay
1 row(s) in 0.0220 seconds
Mallik
  • 196
  • 13