Hello users,

I have 20 rows in an HBase table and the rowkey is in long format starting from 1 to 20. I want to query from this table with the condition like the rowkey starts with 1. I tried with |PrefixFilter| and |BinaryPrefixComparator| but it is working fine only if the rowkey is in string fromat. if it is in long the query returns all the records. How can I achieve this?

Filter expression

|Scan  scan=new  Scan();
Filter  rowFilter=new  RowFilter(CompareOp.EQUAL,  new  
BinaryPrefixComparator(Bytes.toBytes("1")));
//Filter rowFilter=new RowFilter(CompareOp.NOT_EQUAL, new 
BinaryPrefixComparator(Bytes.toBytes("1")));
scan.setFilter(rowFilter);
ResultScanner  resultscanner=htable.getScanner(scan);

Regards,
Vishnu
|

Reply via email to