HBase Or Filter FilterList

Hbase 多条件过滤

  • 使用FilterListWithOR 时会报错,不想去纠结,查阅的了FilterList的API,API 链接

  • api 原文

Implementation of Filter that represents an ordered List of Filters which will be evaluated with a specified boolean operator FilterList.Operator.MUST_PASS_ALL (AND) or FilterList.Operator.MUST_PASS_ONE (OR). Since you can use Filter Lists as children of Filter Lists, you can create a hierarchy of filters to be evaluated.
FilterList.Operator.MUST_PASS_ALL evaluates lazily: evaluation stops as soon as one filter does not include the Cell.
FilterList.Operator.MUST_PASS_ONE evaluates non-lazily: all filters are always evaluated.
Defaults to FilterList.Operator.MUST_PASS_ALL.

  • 个人翻译

Filter的实现是指定的布尔运算符FilterList.Operator.MUST_PASS_ALL(AND)或FilterList.Operator.MUST_PASS_ONE(OR)进行过滤的有序列表。 由于你可以FilterList套FilterList,所以你可以创建层次结构的过滤器。`

FilterList.Operator.MUST_PASS_ALL evaluates lazily: 当其中一个过滤器没有匹配到值则停止继续匹配
FilterList.Operator.MUST_PASS_ONE :所有的过滤器都会进行匹配,(匹配到就会返回Cell)

  • 代码
            Filter filterList = null;
            // ... rowFilters.add(new RowFilter())....
            filterList = new FilterList(FilterList.Operator.MUST_PASS_ONE, rowFilters);
            scan.setFilter(filterList);

你可能感兴趣的:(HBase Or Filter FilterList)