2

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

4

1 回答 1

1

您可以将 SingleColumnValueFilter 与 AND/OR 条件一起使用。

在这里,由于您使用不同的列族,因此使用以下内容:

scan 'person', {FILTER=>"SingleColumnValueFilter('attr','id',=,'binary:p1_03') AND  SingleColumnValueFilter('details','name*',=,'binary:xyz')"}
于 2019-03-05T13:16:25.470 回答