You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Vineet Mishra <cl...@gmail.com> on 2013/11/26 13:18:09 UTC

Hbase Filter for RDBMS IN and AND query operation

Hi All,

I want to fetch some rows from a table where the value for the
Qualifier(say name) is any of ("joseph" ,"sandy", "lar" ) and another
Qualifier(say flag) should always be 1.

I am making multi SingleColumnValueFilter scan on a Table with Compare
Operator to
Equal and those list of values for each Filter.
Applying multi SingleColumnValueFilter is going good, only till I am not
including flag, and without flag my result are incomplete.

Can you tell me which filter or approach to use to get my expected result.

Thanks!

Re: Hbase Filter for RDBMS IN and AND query operation

Posted by lars hofhansl <la...@apache.org>.
Oops. Disregard my other reply then, you figured it out yourself.



________________________________
 From: Vineet Mishra <cl...@gmail.com>
To: user@hbase.apache.org 
Sent: Tuesday, November 26, 2013 6:10 AM
Subject: Re: Hbase Filter for RDBMS IN and AND query operation
 

Yes,

Applying Filter List with Pass ALL containing two filters for name and flag
and iteratively adding it(previous filter list) to another filter list with
(Pass One).




On Tue, Nov 26, 2013 at 7:27 PM, Jean-Marc Spaggiari <
jean-marc@spaggiari.org> wrote:

> Hi vineet,
>
> So how have you solved that finally? Using filters?
>
> JM
>
>
> 2013/11/26 Vineet Mishra <cl...@gmail.com>
>
> > Thanks Marc,
> >
> > I got it working!
> >
> >
> > On Tue, Nov 26, 2013 at 6:49 PM, Jean-Marc Spaggiari <
> > jean-marc@spaggiari.org> wrote:
> >
> > > Hum.
> > >
> > > Phoenix guys will most probably reply that Phoenix is the solution for
> > that
> > > ;) And I will probably agree with them.
> > >
> > > I don't see any filter which can do that within a single call.
> > >
> > > One option I will apply in your case is to do a scan+filter on the
> flag=1
> > > value then do a get name based on the return keys. But that might be to
> > > many gets if you have a lot of values returned.
> > >
> > > Based on your usecase and the size of the name column, another one is
> to
> > > build a MR job. In the map method you keep track of the name and flag
> > > columns, and if you get the 2 before going to the new row, you emit it
> to
> > > another table.
> > >
> > > HTH.
> > >
> > > JM
> > >
> > >
> > > 2013/11/26 Vineet Mishra <cl...@gmail.com>
> > >
> > > > Hi All,
> > > >
> > > > I want to fetch some rows from a table where the value for the
> > > > Qualifier(say name) is any of ("joseph" ,"sandy", "lar" ) and another
> > > > Qualifier(say flag) should always be 1.
> > > >
> > > > I am making multi SingleColumnValueFilter scan on a Table with
> Compare
> > > > Operator to
> > > > Equal and those list of values for each Filter.
> > > > Applying multi SingleColumnValueFilter is going good, only till I am
> > not
> > > > including flag, and without flag my result are incomplete.
> > > >
> > > > Can you tell me which filter or approach to use to get my expected
> > > result.
> > > >
> > > > Thanks!
> > > >
> > >
> >
>

Re: Hbase Filter for RDBMS IN and AND query operation

Posted by Vineet Mishra <cl...@gmail.com>.
Yes,

Applying Filter List with Pass ALL containing two filters for name and flag
and iteratively adding it(previous filter list) to another filter list with
(Pass One).



On Tue, Nov 26, 2013 at 7:27 PM, Jean-Marc Spaggiari <
jean-marc@spaggiari.org> wrote:

> Hi vineet,
>
> So how have you solved that finally? Using filters?
>
> JM
>
>
> 2013/11/26 Vineet Mishra <cl...@gmail.com>
>
> > Thanks Marc,
> >
> > I got it working!
> >
> >
> > On Tue, Nov 26, 2013 at 6:49 PM, Jean-Marc Spaggiari <
> > jean-marc@spaggiari.org> wrote:
> >
> > > Hum.
> > >
> > > Phoenix guys will most probably reply that Phoenix is the solution for
> > that
> > > ;) And I will probably agree with them.
> > >
> > > I don't see any filter which can do that within a single call.
> > >
> > > One option I will apply in your case is to do a scan+filter on the
> flag=1
> > > value then do a get name based on the return keys. But that might be to
> > > many gets if you have a lot of values returned.
> > >
> > > Based on your usecase and the size of the name column, another one is
> to
> > > build a MR job. In the map method you keep track of the name and flag
> > > columns, and if you get the 2 before going to the new row, you emit it
> to
> > > another table.
> > >
> > > HTH.
> > >
> > > JM
> > >
> > >
> > > 2013/11/26 Vineet Mishra <cl...@gmail.com>
> > >
> > > > Hi All,
> > > >
> > > > I want to fetch some rows from a table where the value for the
> > > > Qualifier(say name) is any of ("joseph" ,"sandy", "lar" ) and another
> > > > Qualifier(say flag) should always be 1.
> > > >
> > > > I am making multi SingleColumnValueFilter scan on a Table with
> Compare
> > > > Operator to
> > > > Equal and those list of values for each Filter.
> > > > Applying multi SingleColumnValueFilter is going good, only till I am
> > not
> > > > including flag, and without flag my result are incomplete.
> > > >
> > > > Can you tell me which filter or approach to use to get my expected
> > > result.
> > > >
> > > > Thanks!
> > > >
> > >
> >
>

Re: Hbase Filter for RDBMS IN and AND query operation

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

So how have you solved that finally? Using filters?

JM


2013/11/26 Vineet Mishra <cl...@gmail.com>

> Thanks Marc,
>
> I got it working!
>
>
> On Tue, Nov 26, 2013 at 6:49 PM, Jean-Marc Spaggiari <
> jean-marc@spaggiari.org> wrote:
>
> > Hum.
> >
> > Phoenix guys will most probably reply that Phoenix is the solution for
> that
> > ;) And I will probably agree with them.
> >
> > I don't see any filter which can do that within a single call.
> >
> > One option I will apply in your case is to do a scan+filter on the flag=1
> > value then do a get name based on the return keys. But that might be to
> > many gets if you have a lot of values returned.
> >
> > Based on your usecase and the size of the name column, another one is to
> > build a MR job. In the map method you keep track of the name and flag
> > columns, and if you get the 2 before going to the new row, you emit it to
> > another table.
> >
> > HTH.
> >
> > JM
> >
> >
> > 2013/11/26 Vineet Mishra <cl...@gmail.com>
> >
> > > Hi All,
> > >
> > > I want to fetch some rows from a table where the value for the
> > > Qualifier(say name) is any of ("joseph" ,"sandy", "lar" ) and another
> > > Qualifier(say flag) should always be 1.
> > >
> > > I am making multi SingleColumnValueFilter scan on a Table with Compare
> > > Operator to
> > > Equal and those list of values for each Filter.
> > > Applying multi SingleColumnValueFilter is going good, only till I am
> not
> > > including flag, and without flag my result are incomplete.
> > >
> > > Can you tell me which filter or approach to use to get my expected
> > result.
> > >
> > > Thanks!
> > >
> >
>

Re: Hbase Filter for RDBMS IN and AND query operation

Posted by Vineet Mishra <cl...@gmail.com>.
Thanks Marc,

I got it working!


On Tue, Nov 26, 2013 at 6:49 PM, Jean-Marc Spaggiari <
jean-marc@spaggiari.org> wrote:

> Hum.
>
> Phoenix guys will most probably reply that Phoenix is the solution for that
> ;) And I will probably agree with them.
>
> I don't see any filter which can do that within a single call.
>
> One option I will apply in your case is to do a scan+filter on the flag=1
> value then do a get name based on the return keys. But that might be to
> many gets if you have a lot of values returned.
>
> Based on your usecase and the size of the name column, another one is to
> build a MR job. In the map method you keep track of the name and flag
> columns, and if you get the 2 before going to the new row, you emit it to
> another table.
>
> HTH.
>
> JM
>
>
> 2013/11/26 Vineet Mishra <cl...@gmail.com>
>
> > Hi All,
> >
> > I want to fetch some rows from a table where the value for the
> > Qualifier(say name) is any of ("joseph" ,"sandy", "lar" ) and another
> > Qualifier(say flag) should always be 1.
> >
> > I am making multi SingleColumnValueFilter scan on a Table with Compare
> > Operator to
> > Equal and those list of values for each Filter.
> > Applying multi SingleColumnValueFilter is going good, only till I am not
> > including flag, and without flag my result are incomplete.
> >
> > Can you tell me which filter or approach to use to get my expected
> result.
> >
> > Thanks!
> >
>

Re: Hbase Filter for RDBMS IN and AND query operation

Posted by Jean-Marc Spaggiari <je...@spaggiari.org>.
Hum.

Phoenix guys will most probably reply that Phoenix is the solution for that
;) And I will probably agree with them.

I don't see any filter which can do that within a single call.

One option I will apply in your case is to do a scan+filter on the flag=1
value then do a get name based on the return keys. But that might be to
many gets if you have a lot of values returned.

Based on your usecase and the size of the name column, another one is to
build a MR job. In the map method you keep track of the name and flag
columns, and if you get the 2 before going to the new row, you emit it to
another table.

HTH.

JM


2013/11/26 Vineet Mishra <cl...@gmail.com>

> Hi All,
>
> I want to fetch some rows from a table where the value for the
> Qualifier(say name) is any of ("joseph" ,"sandy", "lar" ) and another
> Qualifier(say flag) should always be 1.
>
> I am making multi SingleColumnValueFilter scan on a Table with Compare
> Operator to
> Equal and those list of values for each Filter.
> Applying multi SingleColumnValueFilter is going good, only till I am not
> including flag, and without flag my result are incomplete.
>
> Can you tell me which filter or approach to use to get my expected result.
>
> Thanks!
>

Re: Hbase Filter for RDBMS IN and AND query operation

Posted by lars hofhansl <la...@apache.org>.
ValueFilter would filter on the value of any qualifier and SingleColumnValueFilter can filter on a specific column.
You can combine the two with a FilterList with MUST_PASS_ALL.

I agree with JM, though, that you should give Phoenix a try.

-- Lars



________________________________
 From: Vineet Mishra <cl...@gmail.com>
To: user@hbase.apache.org 
Sent: Tuesday, November 26, 2013 4:18 AM
Subject: Hbase Filter for RDBMS IN and AND query operation
 

Hi All,

I want to fetch some rows from a table where the value for the
Qualifier(say name) is any of ("joseph" ,"sandy", "lar" ) and another
Qualifier(say flag) should always be 1.

I am making multi SingleColumnValueFilter scan on a Table with Compare
Operator to
Equal and those list of values for each Filter.
Applying multi SingleColumnValueFilter is going good, only till I am not
including flag, and without flag my result are incomplete.

Can you tell me which filter or approach to use to get my expected result.

Thanks!