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);
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容