作者:Syn良子 出处:http://www.cnblogs.com/cssdongl/p/7098138.html 转载请注明出处
我们知道Hbase的Scan经常需要用到filter来过滤表中的数据返回给客户端,单个的filter还好说,如果有多个呢,那么就需要使用FilterList,它也是继承于抽象类Filter,
里面持久化了一个有序的order list来存储不同的filter对数据进行过滤.
FilterList分为二种类型,如下
FilterList allFilters = new FilterList(FilterList.Operator.MUST_PASS_ONE);
或者
FilterList allFilters = new FilterList(FilterList.Operator.MUST_PASS_ALL);
查看源代码,可以仔细看下如下注释
- {@link Operator#MUST_PASS_ALL} evaluates lazily: evaluation stops as soon as one filter does
- not include the KeyValue.
- {@link Operator#MUST_PASS_ONE} evaluates non-lazily: all filters are always evaluated.
二种区别根据上述注释理解,其实就相当于and和or的关系.MUST_PASS_ONE只要sca