简体   繁体   中英

Hbase filter rows based on column and timestamp

I'd like to use the hbase shell to filter columns based on the column value timestamp. For example:

f:my_qualifier  timestamp=1417542508438,  value=some value

I'd like to return all column values where the timestamp is > a particular timestamp. Is this possible using the hbase shell? It looks like the TimestampsFilter requires a particular timestamp, I don't think it is possible to use a comparator.

Thanks in advance!

Use the TIMERANGE option:

scan 't1', {COLUMNS => 'c1', TIMERANGE => [1303668804, 1303668904]}

Take a look at the scan command help for more options:

hbase(main):001:0> scan

Here is some help for this command:
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, TIMESTAMP, MAXLENGTH,
or COLUMNS, CACHE

Some examples:

  hbase> scan '.META.'
  hbase> scan '.META.', {COLUMNS => 'info:regioninfo'}
  hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'}
  hbase> scan 't1', {COLUMNS => 'c1', TIMERANGE => [1303668804, 1303668904]}
  hbase> scan 't1', {FILTER => "(PrefixFilter ('row2') AND (QualifierFilter (>=, 'binary:xyz'))) AND (TimestampsFilter ( 123, 456))"}
  hbase> scan 't1', {FILTER => org.apache.hadoop.hbase.filter.ColumnPaginationFilter.new(1, 0)}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM