简体   繁体   中英

Hbase filter based on a single column and multiple values

I need to scan a hbase table based on a single column. I want to get all the rows which has the column value from one of the values. ie I want to get the rows where cf2:q2 is either A or B. I could use singlecolumnvaluefilter but i had to create a filter for each value. So if i have 10 values i have to use 10 filters. I want to know what is the best way to do this? Is there any better way than creating filters for each value?

ROW                  COLUMN+CELL
     row1                 column=cf1:q1, timestamp=1321296699190, value=TestName1
     row1                 column=cf2:q2, timestamp=1321296715892, value=A
     row2                 column=cf1:q1, timestamp=1321296699190, value=TestName1
     row2                 column=cf2:q2, timestamp=1321296715892, value=B
     row3                 column=cf1:q1, timestamp=1321296699190, value=TestName1
     row3                 column=cf2:q2, timestamp=1321296715892, value=C

I hope the option you mentioned is similar to this link . Most of the suggestions involved the same approach using a FilterList. But as the values increase, it becomes tedious to just add multiple filters for each value. Looks like writing your custom filter, seems the other option. You can get the life cycle events of custom filter in Hbase - Definitive Guide Book; Chapter 4: Client API: Advanced Features . Hope it helps. Happy coding

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM