Reputation: 21
Example table below. I would like to search all the records by last name . How do I query this in Hbase?
Key First Name Last Name Sport
1 John Smith Baseball
2 Wayne Smith Baseball
3 Robert Reynolds Basketball
4 Mark Thompson Basketball
Note: Here my row id is “Key” column.
Upvotes: 0
Views: 85
Reputation: 292
HBase doesn't support secondary indexes.So,technically,you can't query on any other column accept the key. However,you can use filters,for example,
scan 'table', { FILTER => SingleColumnValueFilter.new(Bytes.toBytes('columnFamily'),
Bytes.toBytes('LastName'), CompareFilter::CompareOp.valueOf('EQUAL'),
BinaryComparator.new(Bytes.toBytes('Smith')))}
But that is inefficient as this does not reduce server-side IO,becuse whole scan is done and results are then filtered out.However,it does reduce network bandwidth and reduces the amount of data the client needs to process.
Upvotes: 1