hbase过滤器学习

put 'test1', 'user1_ts1', 'f:c1', 'sku1'
put 'test1', 'user1_ts2', 'f:c1', 'sku188'
put 'test1', 'user1_ts3', 'f:s1', 'sku123'
put 'test1', 'user2_ts4', 'f:c1', 'sku2'
put 'test1', 'user2_ts5', 'f:c2', 'sku288'
put 'test1', 'user2_ts6', 'f:s1', 'sku222'

1. 扫描值等于sku188的记录

scan 'test1', FILTER=>"ValueFilter(=,'binary:sku188')"

ROW COLUMN+CELL

user1_ts2 column=f:c1, timestamp=1589192112394, value=sku188

1 row(s) in 1.5920 seconds

2. 扫描值包含88的记录

scan 'test1', FILTER=>"ValueFilter(=,'substring:88')"

ROW COLUMN+CELL

user1_ts2 column=f:c1, timestamp=1589192112394, value=sku188

user2_ts5 column=f:c2, timestamp=1589192112472, value=sku288

2 row(s) in 13.9120 seconds

3. 扫描列名包含'c2', 而且列值包含'88'的记录

scan 'test1', FILTER=>"ColumnPrefixFilter('c2') AND ValueFilter(=,'substring:88')"

ROW COLUMN+CELL

user2_ts5 column=f:c2, timestamp=1589192112472, value=sku288

1 row(s) in 1.5880 seconds

4. 扫描列名包含'c', 而且列值包含'88'的记录

scan 'test1', FILTER=>"ColumnPrefixFilter('c') AND ValueFilter(=,'substring:88')"

ROW COLUMN+CELL

user1_ts2 column=f:c1, timestamp=1589192112394, value=sku188

user2_ts5 column=f:c2, timestamp=1589192112472, value=sku288

2 row(s) in 3.1850 seconds

5. 扫描列名包含's'且有列值包含'123', 或者列值包含'222'的记录

scan 'test1', FILTER=>"ColumnPrefixFilter('s') AND ( ValueFilter(=,'substring:123') OR ValueFilter(=,'substring:222') )"

ROW COLUMN+CELL

user1_ts3 column=f:s1, timestamp=1589192112432, value=sku123

user2_ts6 column=f:s1, timestamp=1589192114562, value=sku222

2 row(s) in 1.4670 seconds

6. 扫描rowkey前缀为'user1'的记录

scan 'test1', FILTER => "PrefixFilter ('user1')"

ROW COLUMN+CELL

user1_ts1 column=f:c1, timestamp=1589192122941, value=sku1

user1_ts2 column=f:c1, timestamp=1589192112394, value=sku188

user1_ts3 column=f:s1, timestamp=1589192112432, value=sku123

3 row(s) in 19.6350 seconds

7.

我来评几句
登录后评论

已发表评论数()

相关站点

热门文章