Hbase Shell-SingleColumnValueFilter不适用于整数值

时间:2018-06-22 09:26:50

标签: hbase hbase-shell

请帮助我找出一种使SingleColumnValueFilter正常工作的方法

我的hbase表中有一个计数器列和一个过滤器

 FILTER => 
     SingleColumnValueFilter.new(
         Bytes.toBytes('cf'), Bytes.toBytes('counter'), 
         CompareFilter::CompareOp.valueOf('GREATER'), 
         BinaryComparator.new(Bytes.toBytes(2))
     )

不起作用。示例:

    hbase(main):012:0> scan 'hbase_table', { COLUMNS=>'cf:counter:toInt', LIMIT=>10, 
FILTER => SingleColumnValueFilter.new(Bytes.toBytes('cf'), Bytes.toBytes('counter'), CompareFilter::CompareOp.valueOf('GREATER'), BinaryComparator.new(Bytes.toBytes(2)))}
    ROW                                                          COLUMN+CELL
     0001529652065test162tset450967612             column=cf:counter, timestamp=1529654803958, value=1
     0001529652069test7077tset415148873            column=cf:counter, timestamp=1529654755192, value=1
     0001529652071test844tset423513007             column=cf:counter, timestamp=1529656340514, value=1
     0001529652072test291tset206644332             column=cf:counter, timestamp=1529652853191, value=1
     0001529652079test7446tset29252357             column=cf:counter, timestamp=1529655680889, value=1
     0001529652081test132054tset266607692          column=cf:counter, timestamp=1529656829424, value=1
     0001529652083test165tset454118983             column=cf:counter, timestamp=1529652083695, value=1
     0001529652083test27884019tset-8722610         column=cf:counter, timestamp=1529658613610, value=91
     0001529652083test455969tset-56974106          column=cf:counter, timestamp=1529658099511, value=17
     0001529652083test55398tset-143656961          column=cf:counter, timestamp=1529658632410, value=116
    10 row(s) in 0.0360 seconds

但是!过滤器

FILTER => "SingleColumnValueFilter('cf','counter',>,'binary:\x00\x00\x00m')"

起作用

hbase(main):013:0> scan 'hbase_table', { COLUMNS=>'cf:counter:toInt', LIMIT=>10, FILTER => "SingleColumnValueFilter('cf','counter',>,'binary:\x00\x00\x00m')" }
ROW                                                          COLUMN+CELL
 0001529652083test55398tset-143656961          column=cf:counter, timestamp=1529658632410, value=116
 0001529652085test2548970tset-24282202         column=cf:counter, timestamp=1529658694784, value=115
 0001529652085test271647tset-134121211         column=cf:counter, timestamp=1529658642917, value=147
 0001529652086test6679626tset-27895931         column=cf:counter, timestamp=1529658689822, value=322
 0001529652095test383139tset-149094324         column=cf:counter, timestamp=1529658691504, value=500
 0001529652098test3086tset-119461909           column=cf:counter, timestamp=1529658680096, value=150
 0001529652102test23316910tset-57846937        column=cf:counter, timestamp=1529658669844, value=168
 0001529652105test1139525tset-144181254        column=cf:counter, timestamp=1529658658763, value=274
 0001529652105test152959tset-67580761          column=cf:counter, timestamp=1529658667717, value=225
 0001529652113test9213tset-151125407           column=cf:counter, timestamp=1529658688871, value=174
10 row(s) in 0.0330 seconds

我在做什么错了?

谢谢!

0 个答案:

没有答案
相关问题