在hbase中指定多个过滤器 [英] Specify multiple filters in hbase

查看:878
本文介绍了在hbase中指定多个过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在扫描期间指定多个过滤器?例如 - 指定 ColumnFamilyFilter RowFilter

Is there a way to specify multiple filters during a scan? For example - Specify both a ColumnFamilyFilter and RowFilter?

Filter rowFilter =
                new RowFilter(CompareFilter.CompareOp.EQUAL, new RegexStringComparator(
                        rowFilterString));
        Scan s = new Scan();
        s.setFilter(rowFilter);

我还要添加 ColumnFilter 取值。但它显然会覆盖最新的过滤器。

I wanted to also add a ColumnFilter to s. But it obviously overrides the latest filter.

推荐答案

你必须创建一个 FilterList 对象,并添加所需的所有过滤器,并设置此 FilterList 对象作为过滤器。您可以使用构造函数或使用 addFilter()方法将过滤器添加到过滤器列表。

You have to create a FilterList object, and add all the filters you want to that, and set this FilterList object as the filter. You can either use the constructor or use the addFilter() method to add filters to the filter list.

FilterList filterList = new FilterList();
filterList.addFilter(new RowFilter(...));
filterList.addFilter(new ColumnFilter(...));
Scan s = new Scan();
s.setFilter(filterList);

这篇关于在hbase中指定多个过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆