hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Madabhattula Rajesh Kumar <mrajaf...@gmail.com>
Subject Re: Need help on RowFilter
Date Thu, 10 Jul 2014 11:38:58 GMT
Hi Ian,

Thank you very much of the solution. Could you please explain at what are
the use cases we need to use RowFilter?

Regards,
Rajesh


On Thu, Jul 10, 2014 at 4:48 PM, Ian Brooks <i.brooks@sensewhere.com> wrote:

> HI Rajesh,
>
> If you know the rowkeys already, you don't need to perform a scan, you can
> just perform a get on the list of rowkeys
>
> e.g.
>
>
> List<Get> RowKeyList = new ArrayList<Get>();
>
> # for each rowkey
>   RowKeyList.add(new Get(Bytes.toBytes(rowkey)));
>
> Result[] results = table.get(RowKeyList);
>
> for (Result r : results) {
>   for(KeyValue kv : r.raw()) {
>      System.out.print(new String(kv.getRow()) + " ");
>   }
> }
>
> -Ian Brooks
>
> On Thursday 10 Jul 2014 16:38:04 Madabhattula Rajesh Kumar wrote:
> > Hi Team,
> >
> > Could you please help me to resolve below issue.
> >
> > In my hbase table, i've a 30 records. I need to retrieve records based on
> > list of rowkeys. I'm using below code base. It is not giving records
> >
> > HTable table = new HTable(configuration, tableName);
> > List<Filter> filters = new ArrayList<Filter>();
> > Filter rowFilter=new RowFilter(CompareFilter.CompareOp.EQUAL, new
> > BinaryPrefixComparator(Bytes.toBytes(rowkey)));
> > filters.add(rowFilter);
> >
> > Filter rowFilter=new RowFilter(CompareFilter.CompareOp.EQUAL, new
> > BinaryPrefixComparator(Bytes.toBytes(rowkey1)));
> > filters.add(rowFilter);
> >
> > FilterList fl = new FilterList(filters);
> >
> > Scan s = new Scan();
> > s.setFilter(fl);
> > ResultScanner ss = table.getScanner(s);
> > {
> >  for(KeyValue kv : r.raw())
> >   {
> >     System.out.print(new String(kv.getRow()) + " ");
> >   }
> > }
> >
> > Thank you for support
> >
> > Regards,
> > Rajesh
>

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