Reputation: 1245
I have an HBase table, person. I'm using ColumnPrefixFilter and SingleColumnValueFilter to fetch details from HBase table
For suppose, I have entries like below-
ROW_KEY COLUMN+CELL
p1 column='attr:id',value=p1_03
p1 column='details:name_1',value=xyz
p2 column='attr:id',value=p2_04
p2 column='details:name_2',value=xyz
I need to fetch the row_key where name is xyz and id is p1_03. Tried the below query but it results in both row keys.
scan 'person', {FILTER=>"SingleColumnValueFilter('attr','id',=,'binary:p1_03') AND (ColumnPrefixFilter('name') AND ValueFilter(=,'xyz'))"}
Output:
ROW COLUMN+CELL
p1 column='details:name_1',value=xyz
p2 column='details:name_2',value=xyz
I need to get only one row key p1
Upvotes: 2
Views: 3756
Reputation: 20830
You can use SingleColumnValueFilter with AND/OR conditions.
Here since you use different column families, hence use following:
scan 'person', {FILTER=>"SingleColumnValueFilter('attr','id',=,'binary:p1_03') AND SingleColumnValueFilter('details','name*',=,'binary:xyz')"}
Upvotes: 1