简体   繁体   中英

Hbase SingleColumnValueFilter return raw if column doesn't exists

I have an Hbase table which has for some rows col1 qualifier and for the rest, it doesn't. That means that not all the rows have col1 qualifier. I want to filter col1 qualifier on the value dog .

I am using SingleColumnValueFilter :

<Scanner batch="300">
<filter>
    { 
         "type":"SingleColumnValueFilter",
         "op":"EQUAL",
         "family":"YW5pbWFs",
         "qualifier":"Y29sMQ==",
         "latestVersion":true,
         "comparator":{ 
            "type":"BinaryComparator",
            "value":"ZG9n"
         }
      }
</filter>
</Scanner>

I am observing a strange behaviour of SingleColumnValueFilter when I am getting the results. It returns not only the filtered results but also returns rows for which qualifier col1 doesn't exist.

Has anyone faced the same problem? How it can be solved?

ifMissing parameter is a solution.

It seems that SingleColumnValueFilter by default doesn't apply a filter on rows which are a missing qualifier. Missing rows filtering can be enabled by ifMissing parameter.

<Scanner batch="300">
<filter>
    { 
         "type":"SingleColumnValueFilter",
         "op":"EQUAL",
         "family":"YW5pbWFs",
         "qualifier":"Y29sMQ==",
         "latestVersion":true,
         "ifMissing": true,
         "comparator":{ 
            "type":"BinaryComparator",
            "value":"ZG9n"
         }
      }
</filter>
</Scanner>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM