You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Eko Susilo <ek...@gmail.com> on 2017/02/02 10:00:54 UTC

filtering a row that DOESN'T have a column

Hi,

I am looking for a way in hbase how to find rows that doesn't have a
particular column.

I tried combination of QualifierFilter and SkipFilter, but it still can't
pick up the expected rows.

Any suggestion will be appreciated.


Filter filter = new QualifierFilter(CompareFilter.CompareOp.EQUAL,new
BinaryComparator(Bytes.toBytes("column-name")));
Filter filter2 = new SkipFilter(filter);
scan.setFilter(filter2);


-- 
Best Regards,
Eko Susilo

Re: filtering a row that DOESN'T have a column

Posted by Ted Yu <yu...@gmail.com>.
Have you looked at SingleColumnValueFilter ?
For SingleColumnValueFilter, there is a field:

  protected boolean filterIfMissing = false;

You should call setFilterIfMissing(true) on the SingleColumnValueFilter
instance:

   * Get whether entire row should be filtered if column is not found.

   * @return true if row should be skipped if column not found, false if row

   * should be let through anyways

FYI

On Thu, Feb 2, 2017 at 2:00 AM, Eko Susilo <ek...@gmail.com>
wrote:

> Hi,
>
> I am looking for a way in hbase how to find rows that doesn't have a
> particular column.
>
> I tried combination of QualifierFilter and SkipFilter, but it still can't
> pick up the expected rows.
>
> Any suggestion will be appreciated.
>
>
> Filter filter = new QualifierFilter(CompareFilter.CompareOp.EQUAL,new
> BinaryComparator(Bytes.toBytes("column-name")));
> Filter filter2 = new SkipFilter(filter);
> scan.setFilter(filter2);
>
>
> --
> Best Regards,
> Eko Susilo
>