hbase 多个过滤器组合(列表)
使用FilterList要保证过滤器的顺序需要使用List<Filter>
private static void mutilFilterData() throws IOException{
Table table = helper.getConnection().getTable(TableName.valueOf("testtable"));
List<Filter> filters = new ArrayList<Filter>();
Filter filter1 = new RowFilter(CompareOperator.GREATER_OR_EQUAL,
new BinaryComparator(Bytes.toBytes("rowKey60")));
filters.add(filter1);
Filter filter2 = new RowFilter(CompareOperator.LESS_OR_EQUAL,
new BinaryComparator(Bytes.toBytes("rowKey69")));
filters.add(filter2);
Filter filter3 = new QualifierFilter(CompareOperator.EQUAL,
new RegexStringComparator("username"));
filters.add(filter3);
FilterList filterList1 = new FilterList(FilterList.Operator.MUST_PASS_ALL,filters);
Scan scan = new Scan();
scan.setFilter(filterList1);
ResultScanner scanner1 = table.getScanner(scan);
System.out.println("Results of scan #1 - MUST_PASS_ALL:");
int n = 0;
for (Result result : scanner1) {
for (Cell cell : result.rawCells()) {
System.out.println("Cell: " + cell + ", Value: " +
Bytes.toString(cell.getValueArray(), cell.getValueOffset(),
cell.getValueLength()));
n++;
}
}
scanner1.close();
table.close();
}
输出结果:
Cell: rowKey60/info:username/1555078771906/Put/vlen=6/seqid=0, Value: user60
Cell: rowKey61/info:username/1555078771906/Put/vlen=6/seqid=0, Value: user61
Cell: rowKey62/info:username/1555078771906/Put/vlen=6/seqid=0, Value: user62
Cell: rowKey63/info:username/1555078771906/Put/vlen=6/seqid=0, Value: user63
Cell: rowKey64/info:username/1555078771906/Put/vlen=6/seqid=0, Value: user64
Cell: rowKey65/info:username/1555078771906/Put/vlen=6/seqid=0, Value: user65
Cell: rowKey66/info:username/1555078771906/Put/vlen=6/seqid=0, Value: user66
Cell: rowKey67/info:username/1555078771906/Put/vlen=6/seqid=0, Value: user67
Cell: rowKey68/info:username/1555078771906/Put/vlen=6/seqid=0, Value: user68
Cell: rowKey69/info:username/1555078771906/Put/vlen=6/seqid=0, Value: user69
hbase 多个过滤器组合(列表)的更多相关文章
- HBase笔记6 过滤器
过滤器 过滤器是GET或者SCAN时过滤结果用的,相当于SQL的where语句 HBase中的过滤器创建后会被序列化,然后分发到各个region server中,region server会还原过滤器 ...
- HBase学习之路 (十一)HBase的协过滤器
协处理器—Coprocessor 1. 起源 Hbase 作为列族数据库最经常被人诟病的特性包括:无法轻易建立“二级索引”,难以执 行求和.计数.排序等操作.比如,在旧版本的(<0.92)Hba ...
- HBase shell scan 过滤器用法总结
比较器: 前面例子中的regexstring:2014-11-08.*.binary:\x00\x00\x00\x05,这都是比较器.HBase的filter有四种比较器: (1)二进制比较器:如’b ...
- javascript实现组合列表框中元素移动效果
应用背景:在页面中有两个列表框,需要把其中一个列表框的元素移动到另一个列表框 . 实现的基本思想: (1)编写init方法对两个列表框进行初始化: (2)为body添加onload事件调用init方 ...
- [hbase] HBase内置过滤器的一些总结
http://blog.csdn.net/cnweike/article/details/42920547
- HBase之过滤器
filter ==> SQL 中的Where filter的执行流程: 过滤器在客户端创建,然后通过RPC发送到服务器上,由服务器执行 基础过滤器: 比较器: Comparator D ...
- hbase权威指南学习笔记--过滤器
1.使用hbase是shell客户端进行过滤查询 scan 'testtable',{COLUMNS=>'colfam1:col-0',FILTER=>RowFilter.new(Comp ...
- hbase各种遍历查询shell语句 包含过滤组合条件
import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Li ...
- HBase 学习之路(七)——HBase过滤器详解
一.HBase过滤器简介 Hbase提供了种类丰富的过滤器(filter)来提高数据处理的效率,用户可以通过内置或自定义的过滤器来对数据进行过滤,所有的过滤器都在服务端生效,即谓词下推(predica ...
随机推荐
- vue组件--通讯录
简介 在移动端开发中,通讯录是个很常见的需求. 通讯录通常要实现以下功能 首字母导航 滚动到一定位置首字母固定 在线通讯录demo 布局 通讯录是典型的上下两栏布局,上面是header,下面是内容区, ...
- TPO-19 C1 Discussing A Point Raised In A Lecture
TPO-19 C1 Discussing A Point Raised In A Lecture 第 1 段 1.Listen to a conversation between a student ...
- Unity学习笔记(4): 碰撞相关API
Unity3D中的碰撞: 在unity中,有普通碰撞体Collider和触发器(Trigger)两种碰撞体,两个普通碰撞体会发生碰撞并产生力学现象,触发器则像是个无法触碰而又真实存在的东西,也会触发碰 ...
- SVN For Mac: Cornerstone.app破解版免费下载
Cornerstone.app下载地址 链接:https://pan.baidu.com/s/1kwQ65SBgfWXQur8Zdzkyyw 密码:rqe7 Cornerstone303 MAS.a ...
- python函数之format
自python2.6开始,新增了一种格式化字符串的函数str.format(),此函数可以快速处理各种字符串,它增强了字符串格式化的功能. 基本语法是通过{}和:来代替%.format函数可以接受不限 ...
- 2.深入解析数据类型与变量——《Excel VBA 程序开发自学宝典》
2.1 数据类型 数据类型 所占字节 Byte 1 Boolean 2 Integer 2 Long 4 Single 4 Double 8 Currency 8 Decimal 14 Date 8 ...
- kubernetes高可用设计-master节点和kubectl
部署master 节点 上一遍是CA证书和etcd的部署,这一篇继续搭建k8s,废话不多说.开始部署. kubernetes master 节点包含的组件有: kube-apiserver kube- ...
- Metasploit拿Shell
进入metasploit系统 msfconsole Nmap端口扫描 nmap –sV IP(或者域名),如果机器设置有防火墙禁ping,可以使用nmap -P0(或者-Pn) –sV IP(或者域名 ...
- mongodb基本使用(四)
MongoDB 条件操作符 描述 条件操作符用于比较两个表达式并从mongoDB集合中获取数据. MongoDB中条件操作符有: (>) 大于 - $gt (<) 小于 - $lt (&g ...
- axios常用操作
axios常用操作 一:函数化编程 1:编写可复用的方法 axios(config)的方法中,有必须的url参数和非必须的options参数.所以我们可以先写一个接受这两个参数的方法,在这个方法中我们 ...