Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

versioning question in hbase

avatar
Super Collaborator

I can select a particular version from a table , but how can I select a range of versions ? e.g say I want to select all the rows from timestamp 1551108073557 to 1551108018724 ?


hbase(main):005:0> scan 'PERSON',{NAME => 'student',VERSIONS => 5}
ROW COLUMN+CELL
r1 column=student:student_name, timestamp=1551108086986, value=John
r1 column=student:student_name, timestamp=1551108073557, value=Mary
r1 column=student:student_name, timestamp=1551108037609, value=Nancy
r1 column=student:student_name, timestamp=1551108018724, value=Ram
r1 column=student:student_name, timestamp=1551108002231, value=Sam
1 row(s) in 0.0190 seconds

hbase(main):006:0>
hbase(main):007:0*
hbase(main):008:0* get 'PERSON','r1',{COLUMN => 'student', TIMESTAMP => 1551108018724}
COLUMN CELL
student:student_name timestamp=1551108018724, value=Ram

1 ACCEPTED SOLUTION

avatar
Super Guru
hbase(main):001:0> help 'scan'
Scan a table; pass table name and optionally a dictionary of scanner
specifications.  Scanner specifications may include one or more of:
TIMERANGE, FILTER, LIMIT, STARTROW, STOPROW, ROWPREFIXFILTER, TIMESTAMP,
MAXLENGTH or COLUMNS, CACHE or RAW, VERSIONS, ALL_METRICS or METRICS

...

Some examples:

  ...
  hbase> scan 't1', {COLUMNS => 'c1', TIMERANGE => [1303668804000, 1303668904000]}

View solution in original post

4 REPLIES 4

avatar
Super Guru
hbase(main):001:0> help 'scan'
Scan a table; pass table name and optionally a dictionary of scanner
specifications.  Scanner specifications may include one or more of:
TIMERANGE, FILTER, LIMIT, STARTROW, STOPROW, ROWPREFIXFILTER, TIMESTAMP,
MAXLENGTH or COLUMNS, CACHE or RAW, VERSIONS, ALL_METRICS or METRICS

...

Some examples:

  ...
  hbase> scan 't1', {COLUMNS => 'c1', TIMERANGE => [1303668804000, 1303668904000]}

avatar
Super Collaborator

hi Josh how can I do it via 'get' command ? since we will be using java to get these rows

avatar
Super Guru
Use a Scanner. You can't use Gets, as a Get requires you to know a rowKey.

avatar
Super Collaborator

and can "scan" command be called from a java code ?