hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Yu <yuzhih...@gmail.com>
Subject Re: How to Speed up Prefix scan on column qualifier
Date Wed, 24 Aug 2016 12:28:46 GMT
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.chandhok@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
>

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