HBase- Retrieve row based on parts of key

319 views Asked by At

Consider we have a HBase table with rowkey Lname_Fname_DOB. Consider the following rowkeys were inserted in HBase table Cusack_Tim_06062006,Aptrow_Jill_07072007,Cruise_Tom_06052006.

I have a UI, where users can enter the Fname Lname and DOB in separate text boxes. The question I have is if user enters only C in Lname and T in Fname, is there a way to get results of rowkey Cusack_Tim_06062006 and Cruise_Tom_06052006? So basically users may enter only parts of the rowkey, in RDBMS I could use the like function, not sure how to handle this in HBase.

1

There are 1 answers

0
Oussama Jilal On BEST ANSWER

What you need is to use a scanner with the RowFilter and the RegexStringComparator.

But you should know that scanner are very costly in resources, and may take quite some time to give results depending on the amount of data you have.

If you want a real time search you should consider indexing your data in a real search engine (Apache Solr, Sphinx... etc)