hbase shell commands using singlecolumnvalue filter

401 Views Asked by At

I am new to Hbase world and trying the below query. I triggered the below hbase command form shell. I expect to retrieve only the rows which match the filtering criteria: rows matching the column name 'serviceId' with value '61490992624'.

However, it retrieves other rows (rod ids: 100545, 100546,100547,Australia, NSW,NT) as well. I expect only row id TX005 to be retrieved.

any reason to this behaviour?.

hbase(main):024:0> scan 'api_cus_usage', {FILTER=>"SingleColumnValueFilter('usage','serviceId',=,'binary:61490992624')"}
ROW           COLUMN+CELL
 100545        column=usage:colC, timestamp=1569912663258, value=100545
 100546        column=usage:colC, timestamp=1569912663269, value=100546
 100547        column=usage:colC, timestamp=1569912663279, value=100547
 Australia     column=usage:colB, timestamp=1569912663276, value=Australia
 NSW           column=usage:colA, timestamp=1569912663262, value=NSW
 NT            column=usage:colA, timestamp=1569912663272, value=NT
 TX005         column=usage:balanceInstanceId, timestamp=1567147803234, value=3
 TX005         column=usage:eventDateAndTime, timestamp=1567147802721, value=20190815T000000+1000
 TX005         column=usage:serviceId, timestamp=1567147802752, value=61490992624

1

There are 1 best solutions below

0
On

I figured out the reason for the behaviour. The filterIfMissing flag has to be set to true. The below command gave the appropriate results. the last Boolean arg 'true' is for latestVersionOnly. Without that flag, command didnt work.

Thanks to this link: HBase: Records returned where field is not present

scan 'api_cmp_usage', {FILTER=>"SingleColumnValueFilter('usage','serviceId',=,'binary:61490992624',true,true)"}