Reputation: 11
I want to do something like
select * from table where name like '%name%'
is there anyway to do this in Hbase ? and if there is a way so how to do that
ps. I use HappyBase to communicate with Hbase
Upvotes: 0
Views: 457
Reputation: 107
HBase provides a scanner interface that allows you to enumerate over a range of keys in an HTable. HappyBase has support for scans and this is documented pretty well in their API.
So this would solve your question if you were asking for a "like 'name%'" type of query which searches for anything that begins with the prefix 'name'. I am assuming name is the row key in your table, otherwise you would need a secondary index which relates the name field to the row key value of the table or go with the sub-awesome approach of scanning the entire table and doing the matching in Python yourself, depending on your usecase...
Edit: HappyBase also supports passing a 'filter' string assuming you are using a recent HBase version. You could use the SubStringComparator or RegexStringComparator to fit your needs.
Upvotes: 1