Hbase 多部分行键扫描

Hbase multiple partial rowkeys scan

我正在尝试找到一种解决方案来扫描 Hbase table,其中包含来自同一行键的多个部分键。

示例:

RowKey: account_id|name|age|transaction_date
             12345|abc |50 |2016-05-05 08:10:10

这里我想扫描一个 hbase table 以使用以下部分键组合获取所有可能的值:

Rowkey: account_id|transation_date
             12345|2016-05-05 08:10:10

您可以使用 prefix filter....类似下面的内容。

前缀过滤器:

This filter takes one argument a prefix of a row key. It returns only those key-values present in a row that starts with the specified row prefix

Syntax

PrefixFilter (<row_prefix>)

同样可以与 java 客户端一起使用

scan 'yourtable', {FILTER => "PrefixFilter('12345|abc|50|2016-05-05')"}

scan 'yourtable', {STARTROW=>'12345' FILTER => "PrefixFilter('2016-05-05 08:10:10')"}
OR 
scan 'yourtable', {ENDROW='2016-05-05 08:10:10'"}

根据您的要求...

注意:java hbase 扫描 api 如果您想从 java

进行扫描,也有相同的方法

您可以将 RowFilter 与正则表达式一起使用。

scan ‘myTable’, {FILTER => "RowFilter(=, 'regexstring:12345.*2016-05-05 08:10:10’)”}