hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stack <st...@duboce.net>
Subject Re: Filtering by SingleColumnValueFilter
Date Mon, 07 Sep 2009 20:32:58 GMT
Thanks Adrian.  Would you mind making an issue and attaching your patch
there?
Thanks,
St.Ack

On Mon, Sep 7, 2009 at 6:18 AM, Adrian Olariu <olariuadrian@gmail.com>wrote:

> Jonathan, I didn't get any response from you, so I tried to do it my self.
> I did some changes to SingleColumnValueFilter class and now it's working
> like I was expected.
> Actualy it was simple: if the filter noesn't find inside a row a
> Column-Value match than the FilterRow method should return true.
> I posted this here maybe it will help others.
>
> On Fri, Sep 4, 2009 at 9:12 AM, Adrian Olariu <olariuadrian@gmail.com
> >wrote:
>
> > Exactly, in both cases I don't want any row emitted.
> > Thanks.
> >
> >
> > On Fri, Sep 4, 2009 at 3:10 AM, Jonathan Gray <jlist@streamy.com> wrote:
> >
> >> And what you want to happen is, if either of the conditions fail, that
> the
> >> entire row is not emitted?  What do you want to happen if either of the
> >> columns don't exist at all?
> >>
> >> Let me play around with some unit tests tomorrow and I will report back.
> >>
> >> Thanks.
> >>
> >> JG
> >>
> >> On Thu, September 3, 2009 11:56 am, Adrian Olariu wrote:
> >> > The behavior described in the first pace was whit
> >> > FilterList.MUST_PASS_ALL.
> >> > I did copy/paste without checking twice, sorry about that.
> >> >
> >> >
> >> > Found row: keyvalues={135/F1:c2/1251994608272/Put/vlen=1}
> >> > Found row: keyvalues={141/F1:c1/1251994608289/Put/vlen=1}
> >> > Found row: keyvalues={143/F1:c1/1251994608293/Put/vlen=1,
> >> > 143/F1:c2/1251994608293/Put/vlen=1}
> >> > Found row: keyvalues={144/F1:c1/1251994608295/Put/vlen=1}
> >> > Found row: keyvalues={152/F1:c2/1251994608314/Put/vlen=1}
> >> > this results I'm getting when I'm using must MUST_PASS_ALL.
> >> >
> >> >
> >> > On Thu, Sep 3, 2009 at 9:07 PM, Jonathan Gray <jlist@streamy.com>
> >> wrote:
> >> >
> >> >
> >> >> You are using FilterList.MUST_PASS_ONE... That is an OR condition.
> >> >>
> >> >>
> >> >> You want FilterList.MUST_PASS_ALL if you want it to require both
> >> >> conditions to be met.
> >> >>
> >> >> If you want to include _other_ columns from that family if _these_
> two
> >> >> conditions are met (but the row skipped if the two conditions does
> not
> >> >> match), then wrap the FilterList w/ a SkipFilter and use addFamily
> >> >> rather than addColumns.  If you just want the row and the two columns
> >> >> you are checking for, use addColumn calls and don't use the
> SkipFilter.
> >> >>
> >> >> Hope that helps... and hope it works as you expect :)
> >> >>
> >> >>
> >> >> Is there somewhere we could add better documentation?  FilterList
> >> >> should explain AND/OR operations.
> >> >>
> >> >> JG
> >> >>
> >> >>
> >> >> On Thu, September 3, 2009 10:46 am, Adrian Olariu wrote:
> >> >>
> >> >>> Thanks for quick replay, I want only the rows that matches BOTH
> >> >>> conditions. Detailed: all the rows that have this two columns and
> the
> >> >>> values from this two columns must match values specified in code.
> >> >>>
> >> >>> On Thu, Sep 3, 2009 at 8:37 PM, Jonathan Gray <jlist@streamy.com>
> >> >>> wrote:
> >> >>>
> >> >>>
> >> >>>
> >> >>>> That filter just underwent a rewrite this week, there is certainly
> >> >>>> possibility for a bug... However it does seem you are seeing
> >> >>>> expected behavior.
> >> >>>>
> >> >>>> What exactly are you trying to do?  You want to return the
entire
> >> >>>> row if it makes the value (get all columns in the family if
one
> >> >>>> column matches), if it matches BOTH, if it matches EITHER...
I
> don't
> >> >>>> follow exactly what you want to have as the end result returned
to
> >> >>>> the client.
> >> >>>>
> >> >>>> Could you define more specifically what you want your result
to be?
> >> >>>>
> >> >>>>
> >> >>>>
> >> >>>> JG
> >> >>>>
> >> >>>>
> >> >>>>
> >> >>>> On Thu, September 3, 2009 10:08 am, Adrian Olariu wrote:
> >> >>>>
> >> >>>>
> >> >>>>> Hi,
> >> >>>>> I'm trying to use some filters and the results are not
like
> >> >>>>> expected. Maybe there it's a bug. I'm using HBase 0.20.0
RC3
> >> >>>>> I'm trying to filter rows using SingleColumnValueFilter
like this:
> >> >>>>>  Scan s = new Scan();
> >> >>>>>
> >> >>>>>
> >> >>>>>
> >> >>>>>
> >> >>>>> Filter filter1 = new SingleColumnValueFilter(Bytes.toBytes("F1"),
> >> >>>>>  Bytes.toBytes("c1"), CompareOp.EQUAL, Bytes.toBytes("1"));
> >> >>>>> Filter filter2 = new SingleColumnValueFilter(Bytes.toBytes("F1"),
> >> >>>>> Bytes.toBytes("c2"), CompareOp.EQUAL, Bytes.toBytes("1"));
> >> >>>>> List<Filter> rowFilters = new ArrayList<Filter>();
> >> >>>>> rowFilters.add(filter1);rowFilters.add(filter2); Filter
filter =
> >> >>>>> new FilterList(FilterList.Operator.MUST_PASS_ONE,
> >> >>>>> rowFilters);
> >> >>>>>
> >> >>>>> s.addColumn(Bytes.toBytes("F1"), Bytes.toBytes("c1"));
> >> >>>>> s.addColumn(Bytes.toBytes("F1"), Bytes.toBytes("c2"));
> >> >>>>> s.setFilter(filter);
> >> >>>>>
> >> >>>>> long startTime = System.currentTimeMillis(); ResultScanner
> >> >>>>> scanner = table.getScanner(s);
> >> >>>>>
> >> >>>>> This filter returns all rows the contains F1:c1 whit val
"1" or
> >> >>>>> contains F1:c2 whit val "1" or contains both. If I replace
> >> >>>>> "addColumn" methods whit s.addFamily("F1"); the scanner
> >> >>>>> returns all rows from the table whit no filtering eaven
if the
> >> >>>>> F1:c1/c2
> >> >>>>> columns doesn't exist
> >> >>>>>
> >> >>>>> How can I get only the rows that matches all the conditions?
> >> >>>>>
> >> >>>>>
> >> >>>>>
> >> >>>>>
> >> >>>>> Thank you,
> >> >>>>> Olariu Adrian.
> >> >>>>>
> >> >>>>>
> >> >>>>>
> >> >>>>>
> >> >>>>
> >> >>>>
> >> >>>
> >> >>
> >> >>
> >> >
> >>
> >>
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message