If you are on HBase 1.+ you can use

Scan API:

setRowPrefixFilter(byte[] rowPrefix)


-Vlad

On Wed, Aug 24, 2016 at 5:28 AM, Ted Yu <yuzhih...@gmail.com> wrote:

> Please use the following API to set start row before calling
> hTable.getScanner(scan):
>
>   public Scan setStartRow(byte [] startRow) {
>
> On Wed, Aug 24, 2016 at 5:08 AM, Manjeet Singh <manjeet.chand...@gmail.com
> >
> wrote:
>
> > Hi All,
> >
> > I have below code where I have row key like 9865327845_#RandomChar
> > I want to perform prefix scan I tryed with ResultScanner  which has
> > performance impact
> > I have seen in some articles people saying about Get and setFilter but
> its
> > not working
> > can anyone suggest me better way, below is my code
> >
> > public static HashSet  getResultByPreFixFilterScan(String rowkeys){
> > Scan scan = new Scan();
> > PrefixFilter prefixFilter = new PrefixFilter(rowkeys.getBytes());
> > scan.setFilter(prefixFilter);
> > ResultScanner resultScanner = null;
> > try {
> > resultScanner = hTable.getScanner(scan);
> > } catch (IOException e) {
> > // TODO Auto-generated catch block
> > e.printStackTrace();
> > }
> >
> > HashSet<String> rowKeySet=new HashSet<String>();
> > //Result result = table.get(g);
> > for (Result results : resultScanner) {
> > for(KeyValue kv : results.raw()){
> > rowKeySet.add(new String(kv.getRow()));
> >
> > }
> > }
> > return rowKeySet;
> > }
> >
> >
> >
> >
> >
> > can we perform prefix by
> > Filter filter = new QualifierFilter(CompareFilter.CompareOp.EQUAL,  new
> > BinaryComparator(Bytes.toBytes(rowkeys)));
> >
> > Thanks
> > Manjeet
> >
> > --
> > luv all
> >
>

Reply via email to