Get is used to retrieve single row. If Get serves your need, you don't need PrefixFilter.
On Wed, Aug 24, 2016 at 11:58 AM, Manjeet Singh <[email protected]> wrote: > I am using 1.2.1 > > I have tried these but actually ResultScanner took long time > is their any way to use Get with filter? > HBase already exposed setFilter method on Get class but its not working > > On Wed, Aug 24, 2016 at 10:56 PM, Vladimir Rodionov < > [email protected]> > wrote: > > > 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 <[email protected]> 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 < > > [email protected] > > > > > > > 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 > > > > > > > > > > > > > -- > luv all >
