hbase根据列和时间戳筛选行

wqlqzqxt  于 2021-06-09  发布在  Hbase
关注(0)|答案(1)|浏览(798)

我想使用hbase shell根据列值timestamp过滤列。例如:

f:my_qualifier  timestamp=1417542508438,  value=some value

我想返回时间戳>特定时间戳的所有列值。是否可以使用hbase shell执行此操作?看起来timestampsfilter需要一个特定的时间戳,我认为不可能使用比较器。
提前谢谢!

ecbunoof

ecbunoof1#

使用时间范围选项:

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

有关更多选项,请参阅扫描命令帮助:

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)}

相关问题