You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Ted <r6...@gmail.com> on 2013/10/24 10:54:26 UTC

filtering rows for column values not null

Hi I have a relatively simple situation,

As an example I have a table of Users, with first and last name.

I set a scan a FilterList and I add a SingleColumnValueFilter, with
column qualifier=firstName, CompareOp.EQUAL, and value="bob".

The problem is, I'm getting "bob" as well as anyone with out a firstName.

I tried adding NOT_EQUALS null and NOT_EQUALS (new byte[0]) and neither helped.

Does anyone know of how to filter on a column value not null?
-- 
Ted.

RE: filtering rows for column values not null

Posted by Vladimir Rodionov <vr...@carrieriq.com>.
This will work ONLY if you add single column to scan. If you scan multiple columns you will
need additional filter (reverse SkipFilter) which filter outs all rows (outputs of SingleColumnValueFilter) which
do not have 'firstName' column. I do not think HBase provide similar filter but you can create it yourself.

See SkipFilter java source

Best regards,
Vladimir Rodionov
Principal Platform Engineer
Carrier IQ, www.carrieriq.com
e-mail: vrodionov@carrieriq.com

________________________________________
From: Vladimir Rodionov
Sent: Thursday, October 24, 2013 9:07 AM
To: user@hbase.apache.org
Subject: RE: filtering rows for column values not null

If 'firstName' is NULL - it is missing completely from a row. Add explicitly this column to Scan you create:

scan.addColumn(YOUR_CF, 'firstName'.getBytes());

Best regards,
Vladimir Rodionov
Principal Platform Engineer
Carrier IQ, www.carrieriq.com
e-mail: vrodionov@carrieriq.com

________________________________________
From: Ted [r6squeegee@gmail.com]
Sent: Thursday, October 24, 2013 1:54 AM
To: user@hbase.apache.org
Subject: filtering rows for column values not null

Hi I have a relatively simple situation,

As an example I have a table of Users, with first and last name.

I set a scan a FilterList and I add a SingleColumnValueFilter, with
column qualifier=firstName, CompareOp.EQUAL, and value="bob".

The problem is, I'm getting "bob" as well as anyone with out a firstName.

I tried adding NOT_EQUALS null and NOT_EQUALS (new byte[0]) and neither helped.

Does anyone know of how to filter on a column value not null?
--
Ted.

Confidentiality Notice:  The information contained in this message, including any attachments hereto, may be confidential and is intended to be read only by the individual or entity to whom this message is addressed. If the reader of this message is not the intended recipient or an agent or designee of the intended recipient, please note that any review, use, disclosure or distribution of this message or its attachments, in any form, is strictly prohibited.  If you have received this message in error, please immediately notify the sender and/or Notifications@carrieriq.com and delete or destroy any copy of this message and its attachments.

Re: filtering rows for column values not null

Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
I will have said:
scan.addColumn(YOUR_CF, Bytes.toBytes("firstName"));
But not sure if it really makes a difference...


2013/10/24 Vladimir Rodionov <vr...@carrieriq.com>

> If 'firstName' is NULL - it is missing completely from a row. Add
> explicitly this column to Scan you create:
>
> scan.addColumn(YOUR_CF, 'firstName'.getBytes());
>
> Best regards,
> Vladimir Rodionov
> Principal Platform Engineer
> Carrier IQ, www.carrieriq.com
> e-mail: vrodionov@carrieriq.com
>
> ________________________________________
> From: Ted [r6squeegee@gmail.com]
> Sent: Thursday, October 24, 2013 1:54 AM
> To: user@hbase.apache.org
> Subject: filtering rows for column values not null
>
> Hi I have a relatively simple situation,
>
> As an example I have a table of Users, with first and last name.
>
> I set a scan a FilterList and I add a SingleColumnValueFilter, with
> column qualifier=firstName, CompareOp.EQUAL, and value="bob".
>
> The problem is, I'm getting "bob" as well as anyone with out a firstName.
>
> I tried adding NOT_EQUALS null and NOT_EQUALS (new byte[0]) and neither
> helped.
>
> Does anyone know of how to filter on a column value not null?
> --
> Ted.
>
> Confidentiality Notice:  The information contained in this message,
> including any attachments hereto, may be confidential and is intended to be
> read only by the individual or entity to whom this message is addressed. If
> the reader of this message is not the intended recipient or an agent or
> designee of the intended recipient, please note that any review, use,
> disclosure or distribution of this message or its attachments, in any form,
> is strictly prohibited.  If you have received this message in error, please
> immediately notify the sender and/or Notifications@carrieriq.com and
> delete or destroy any copy of this message and its attachments.
>

RE: filtering rows for column values not null

Posted by Vladimir Rodionov <vr...@carrieriq.com>.
If 'firstName' is NULL - it is missing completely from a row. Add explicitly this column to Scan you create:

scan.addColumn(YOUR_CF, 'firstName'.getBytes());

Best regards,
Vladimir Rodionov
Principal Platform Engineer
Carrier IQ, www.carrieriq.com
e-mail: vrodionov@carrieriq.com

________________________________________
From: Ted [r6squeegee@gmail.com]
Sent: Thursday, October 24, 2013 1:54 AM
To: user@hbase.apache.org
Subject: filtering rows for column values not null

Hi I have a relatively simple situation,

As an example I have a table of Users, with first and last name.

I set a scan a FilterList and I add a SingleColumnValueFilter, with
column qualifier=firstName, CompareOp.EQUAL, and value="bob".

The problem is, I'm getting "bob" as well as anyone with out a firstName.

I tried adding NOT_EQUALS null and NOT_EQUALS (new byte[0]) and neither helped.

Does anyone know of how to filter on a column value not null?
--
Ted.

Confidentiality Notice:  The information contained in this message, including any attachments hereto, may be confidential and is intended to be read only by the individual or entity to whom this message is addressed. If the reader of this message is not the intended recipient or an agent or designee of the intended recipient, please note that any review, use, disclosure or distribution of this message or its attachments, in any form, is strictly prohibited.  If you have received this message in error, please immediately notify the sender and/or Notifications@carrieriq.com and delete or destroy any copy of this message and its attachments.

Re: filtering rows for column values not null

Posted by Ted <r6...@gmail.com>.
yes! that was exactly what I was looking for.

thanks.
Ted

On 10/24/13, Toby Lazar <tl...@capitaltg.com> wrote:
> I think Ted is looking for the SingleColumnValueFilter.setFilterIfMissing()
> method.  Try setting that to true.
>
> Toby
>
> *******************************
>   Toby Lazar
>   Capital Technology Group
>   Email: tlazar@capitaltg.com
>   Mobile: 646-469-5865
> *******************************
>
>
> On Thu, Oct 24, 2013 at 9:23 AM, Jean-Marc Spaggiari <
> jean-marc@spaggiari.org> wrote:
>
>> Hi Ted,
>>
>> I'm not sure to get you. HBase will not store any cell in the system if
>> there is no content. So if you do a scan, you will get only the cells
>> where
>> the content is not null. There is no need to have any filter here. Can
>> you
>> please detail what you put in the table and what cells you are trying to
>> NOT read?
>>
>> JM
>>
>>
>> 2013/10/24 Ted <r6...@gmail.com>
>>
>> > Hi I have a relatively simple situation,
>> >
>> > As an example I have a table of Users, with first and last name.
>> >
>> > I set a scan a FilterList and I add a SingleColumnValueFilter, with
>> > column qualifier=firstName, CompareOp.EQUAL, and value="bob".
>> >
>> > The problem is, I'm getting "bob" as well as anyone with out a
>> > firstName.
>> >
>> > I tried adding NOT_EQUALS null and NOT_EQUALS (new byte[0]) and neither
>> > helped.
>> >
>> > Does anyone know of how to filter on a column value not null?
>> > --
>> > Ted.
>> >
>>
>


-- 
Ted.

Re: filtering rows for column values not null

Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
Got it! I looked at the opposite way: "How to get only the row where it's
null". Toby is correct.

JM


2013/10/24 Toby Lazar <tl...@capitaltg.com>

> I think Ted is looking for the SingleColumnValueFilter.setFilterIfMissing()
> method.  Try setting that to true.
>
> Toby
>
> *******************************
>   Toby Lazar
>   Capital Technology Group
>   Email: tlazar@capitaltg.com
>   Mobile: 646-469-5865
> *******************************
>
>
> On Thu, Oct 24, 2013 at 9:23 AM, Jean-Marc Spaggiari <
> jean-marc@spaggiari.org> wrote:
>
> > Hi Ted,
> >
> > I'm not sure to get you. HBase will not store any cell in the system if
> > there is no content. So if you do a scan, you will get only the cells
> where
> > the content is not null. There is no need to have any filter here. Can
> you
> > please detail what you put in the table and what cells you are trying to
> > NOT read?
> >
> > JM
> >
> >
> > 2013/10/24 Ted <r6...@gmail.com>
> >
> > > Hi I have a relatively simple situation,
> > >
> > > As an example I have a table of Users, with first and last name.
> > >
> > > I set a scan a FilterList and I add a SingleColumnValueFilter, with
> > > column qualifier=firstName, CompareOp.EQUAL, and value="bob".
> > >
> > > The problem is, I'm getting "bob" as well as anyone with out a
> firstName.
> > >
> > > I tried adding NOT_EQUALS null and NOT_EQUALS (new byte[0]) and neither
> > > helped.
> > >
> > > Does anyone know of how to filter on a column value not null?
> > > --
> > > Ted.
> > >
> >
>

Re: filtering rows for column values not null

Posted by Toby Lazar <tl...@capitaltg.com>.
I think Ted is looking for the SingleColumnValueFilter.setFilterIfMissing()
method.  Try setting that to true.

Toby

*******************************
  Toby Lazar
  Capital Technology Group
  Email: tlazar@capitaltg.com
  Mobile: 646-469-5865
*******************************


On Thu, Oct 24, 2013 at 9:23 AM, Jean-Marc Spaggiari <
jean-marc@spaggiari.org> wrote:

> Hi Ted,
>
> I'm not sure to get you. HBase will not store any cell in the system if
> there is no content. So if you do a scan, you will get only the cells where
> the content is not null. There is no need to have any filter here. Can you
> please detail what you put in the table and what cells you are trying to
> NOT read?
>
> JM
>
>
> 2013/10/24 Ted <r6...@gmail.com>
>
> > Hi I have a relatively simple situation,
> >
> > As an example I have a table of Users, with first and last name.
> >
> > I set a scan a FilterList and I add a SingleColumnValueFilter, with
> > column qualifier=firstName, CompareOp.EQUAL, and value="bob".
> >
> > The problem is, I'm getting "bob" as well as anyone with out a firstName.
> >
> > I tried adding NOT_EQUALS null and NOT_EQUALS (new byte[0]) and neither
> > helped.
> >
> > Does anyone know of how to filter on a column value not null?
> > --
> > Ted.
> >
>

Re: filtering rows for column values not null

Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
Hi Ted,

I'm not sure to get you. HBase will not store any cell in the system if
there is no content. So if you do a scan, you will get only the cells where
the content is not null. There is no need to have any filter here. Can you
please detail what you put in the table and what cells you are trying to
NOT read?

JM


2013/10/24 Ted <r6...@gmail.com>

> Hi I have a relatively simple situation,
>
> As an example I have a table of Users, with first and last name.
>
> I set a scan a FilterList and I add a SingleColumnValueFilter, with
> column qualifier=firstName, CompareOp.EQUAL, and value="bob".
>
> The problem is, I'm getting "bob" as well as anyone with out a firstName.
>
> I tried adding NOT_EQUALS null and NOT_EQUALS (new byte[0]) and neither
> helped.
>
> Does anyone know of how to filter on a column value not null?
> --
> Ted.
>