You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by fateme Abiri <fa...@yahoo.com> on 2013/12/17 15:14:48 UTC

scan table using multi row prefix match

hi friends
I want to use a filter in hbase to return  rows with different prefix... 

for eg. my rows structure are  <id>+URLStrings

so i want to return rows with  4  <id> prefix :
<12234>

<4534>

<134>
<4234>
how can I do that?
i use 

FilterLis RowFilterlist; RowFilterlist= new FilterLis(FilterList.Operator.Must_PASS_ON)

//add 4 id to prefix match....

for(int i=0;i<5;i++){
id=getID(i);
RowFilterlist.addFilter(new RowFilter(CompareFilter.CompareOp.EQUAL, new RegexStringComparator("<"+id+">"+"[\\S]+"));
}
scan.setFilter(RowFilterlist);

is it correct? its return wrong rows !!!

Re: scan table using multi row prefix match

Posted by Ted Yu <yu...@gmail.com>.
Have you looked at this filter ?
src/main/java/org/apache/hadoop/hbase/filter/PrefixFilter.java

Cheers


On Tue, Dec 17, 2013 at 7:14 AM, fateme Abiri <fa...@yahoo.com>wrote:

> hi my freiend...
> tanx for your feedback...
>
> i m sorry, i take a mistake when i wrote in my email, i write correctly in
> my IDE,
> but  the rows which was returned only match with one of the <id>prefix
> filters!!!
>
>
>
>
>
> On Tuesday, December 17, 2013 5:57 PM, Ted Yu <yu...@gmail.com> wrote:
>
> An 'E' is missing from MUST_PASS_ON
>
> The for loop has 5 iterations instead of 4.
>
> Cheers
>
>
> On Dec 17, 2013, at 6:14 AM, fateme Abiri <fa...@yahoo.com> wrote:
>
> > hi friends
> > I want to use a filter in hbase to return  rows with different prefix...
> >
> > for eg. my rows structure are  <id>+URLStrings
> >
> > so i want to return rows with  4  <id> prefix :
> > <12234>
> >
> > <4534>
> >
> > <134>
> >
>  <4234>
> > how can I do that?
> > i use
> >
> > FilterLis RowFilterlist; RowFilterlist= new
> FilterLis(FilterList.Operator.Must_PASS_ON)
> >
> > //add 4 id to prefix match....
> >
> > for(int i=0;i<5;i++){
> > id=getID(i);
> > RowFilterlist.addFilter(new RowFilter(CompareFilter.CompareOp.EQUAL, new
> RegexStringComparator("<"+id+">"+"[\\S]+"));
> > }
> > scan.setFilter(RowFilterlist);
> >
> > is it correct? its return wrong rows !!!
>

Re: scan table using multi row prefix match

Posted by fateme Abiri <fa...@yahoo.com>.
hi my freiend...
tanx for your feedback...

i m sorry, i take a mistake when i wrote in my email, i write correctly in my IDE,
but  the rows which was returned only match with one of the <id>prefix filters!!!





On Tuesday, December 17, 2013 5:57 PM, Ted Yu <yu...@gmail.com> wrote:
 
An 'E' is missing from MUST_PASS_ON

The for loop has 5 iterations instead of 4. 

Cheers


On Dec 17, 2013, at 6:14 AM, fateme Abiri <fa...@yahoo.com> wrote:

> hi friends
> I want to use a filter in hbase to return  rows with different prefix... 
> 
> for eg. my rows structure are  <id>+URLStrings
> 
> so i want to return rows with  4  <id> prefix :
> <12234>
> 
> <4534>
> 
> <134>
>
 <4234>
> how can I do that?
> i use 
> 
> FilterLis RowFilterlist; RowFilterlist= new FilterLis(FilterList.Operator.Must_PASS_ON)
> 
> //add 4 id to prefix match....
> 
> for(int i=0;i<5;i++){
> id=getID(i);
> RowFilterlist.addFilter(new RowFilter(CompareFilter.CompareOp.EQUAL, new RegexStringComparator("<"+id+">"+"[\\S]+"));
> }
> scan.setFilter(RowFilterlist);
> 
> is it correct? its return wrong rows !!!

Re: scan table using multi row prefix match

Posted by Ted Yu <yu...@gmail.com>.
An 'E' is missing from MUST_PASS_ON

The for loop has 5 iterations instead of 4. 

Cheers

On Dec 17, 2013, at 6:14 AM, fateme Abiri <fa...@yahoo.com> wrote:

> hi friends
> I want to use a filter in hbase to return  rows with different prefix... 
> 
> for eg. my rows structure are  <id>+URLStrings
> 
> so i want to return rows with  4  <id> prefix :
> <12234>
> 
> <4534>
> 
> <134>
> <4234>
> how can I do that?
> i use 
> 
> FilterLis RowFilterlist; RowFilterlist= new FilterLis(FilterList.Operator.Must_PASS_ON)
> 
> //add 4 id to prefix match....
> 
> for(int i=0;i<5;i++){
> id=getID(i);
> RowFilterlist.addFilter(new RowFilter(CompareFilter.CompareOp.EQUAL, new RegexStringComparator("<"+id+">"+"[\\S]+"));
> }
> scan.setFilter(RowFilterlist);
> 
> is it correct? its return wrong rows !!!