我正在尝试找到一种解决方案来扫描 Hbase 表,其中多个部分键来自同一行键。
示例:
RowKey: account_id|name|age|transaction_date
12345|abc |50 |2016-05-05 08:10:10
这里我想扫描 hbase 表以使用以下部分组合键获取所有可能的值:
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 进行扫描,java hbase scan api 也有相同的方法
关于Hbase多个部分rowkey扫描,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40875027/