hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Yu <yuzhih...@gmail.com>
Subject Re: query multiple specified columns using filterlist
Date Thu, 04 Aug 2016 09:13:35 GMT
You can use FilterList to put the filters together:

  public FilterList(final Operator operator) {

AND -> MUST_PASS_ALL

On Thu, Aug 4, 2016 at 2:07 AM, 乔彦克 <qyanke@gmail.com> wrote:

> Thanks for the advice, Ted.
> I have the column prefix and the column value( in fact these two filters
> are are in the same column), but don't have the column name, so I can't use
> SingleColumnValueFilter.
> *Now I use two qualifierFilters and a ColumnPrefixFilter to specify three
> columns, and a value filter to filter the values. The logical between these
> Filters are 'OR',  but what I want is 'AND'?  Is there some ways to help me
> with that? Below is the filters I used.*
>
> QualifierFilter qfilter = new
> QualifierFilter(CompareFilter.CompareOp.EQUAL, new
> BinaryComparator(Bytes.toBytes("qualifier1")));
> QualifierFilter qfilter2 = new
> QualifierFilter(CompareFilter.CompareOp.EQUAL, new
> BinaryComparator(Bytes.toBytes("qualifier2")));
>
> // *'e:cat' is the column prefix, and 'hello kitty' is the value of
> 'e:cat?' column*
>
> ColumnPrefixFilter columnPrefixFilter = new
> ColumnPrefixFilter(Bytes.toBytes("e:cat"));
>
> Filter valueFilter = new ValueFilter(CompareFilter.CompareOp.EQUAL,
> new BinaryComparator(
>         Bytes.toBytes("hello kitty")));
>
>
>
> Ted Yu <yuzhihong@gmail.com>于2016年8月4日周四 上午11:56写道:
>
> > For selecting column with same prefix, consider using ColumnPrefixFilter.
> >
> > For filtering value, consider using SingleColumnValueFilter.
> >
> > On Wed, Aug 3, 2016 at 7:52 PM, 乔彦克 <qyanke@gmail.com> wrote:
> >
> > > Thanks for your reply, Ted.
> > > Addition, if I want to filter another column -- one or many columns
> with
> > > one same column prefix, how can I deal with the filter or filter list.
> > what
> > > if I have to filter a value from the columns, beside to use
> valueFilter,
> > is
> > > there another filter or filter to query this?
> > >
> > > eg:   column prefix :* e:cat*,
> > >          specified columns maybe:  *e:cat1, e:cat2, e:cat3,*
> > >          the value :* 'hello kitty' ,*
> > >
> > > Any advice is appreciated!
> > > QiaoYanke
> > >
> > >
> > > Ted Yu <yuzhihong@gmail.com>于2016年8月3日周三 上午3:15写道:
> > >
> > > > You can use the following method of Scan to specify columns to
> > retrieve:
> > > >
> > > >   public Scan addColumn(byte [] family, byte [] qualifier) {
> > > >
> > > > w.r.t. value comparison with cf:c3 column, consider using
> > > > SingleColumnValueFilter.
> > > >
> > > > Cheers
> > > >
> > > > On Mon, Aug 1, 2016 at 6:56 PM, 乔彦克 <qyanke@gmail.com> wrote:
> > > >
> > > > > Hi all,
> > > > >
> > > > > Currently I am using HBase client api to fetch data from HBase,
> and I
> > > > want
> > > > > to get 3 columns (cf:c1,cf:c2,cf:c3), and some value equals cf:c3
> > > column,
> > > > > But I don't know how to construct the filterList to achieve this,
> So
> > > How
> > > > > can I do with that?
> > > > > Any suggestion will be appreciated!
> > > > >
> > > > >
> > > > > Best Regards,
> > > > > QiaoYanke
> > > > >
> > > >
> > >
> >
>

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