简体   繁体   English

基于单列和多个值的Hbase过滤器

[英]Hbase filter based on a single column and multiple values

I need to scan a hbase table based on a single column. 我需要基于单个列扫描hbase表。 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. 即我想获取cf2:q2是A或B的行。我可以使用singlecolumnvaluefilter,但必须为每个值创建一个过滤器。 So if i have 10 values i have to use 10 filters. 因此,如果我有10个值,则必须使用10个过滤器。 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. 大多数建议都涉及使用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; 您可以在《 Hbase-权威指南》获取自定义过滤器的生命周期事件 Chapter 4: Client API: Advanced Features . 第4章:客户端API:高级功能 Hope it helps. 希望能帮助到你。 Happy coding 快乐编码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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