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 ...
随机推荐
- 五、Django之视图和模板-Part 3
一.概述 一个视图就是一个页面,通常提供特定的功能,使用特定的模版.列如:在一个博客应用中,你可能会看到下列视图: 博客主页:显示最新发布的一些内容 每篇博客的详细页面:博客的永久链接 基于年的博客页 ...
- Socket之简单的Unity3D聊天室__TCP协议
服务器端程序 using System; using System.Collections.Generic; using System.Linq; using System.Net; using Sy ...
- 【翻译】HOG, Histogram of Oriented Gradients / 方向梯度直方图 介绍
本文翻译自 SATYA MALLICK 的 "Histogram of Oriented Gradients" 原文链接: https://www.learnopencv.com/ ...
- 开源ETL工具kettle系列之常见问题
开源ETL工具kettle系列之常见问题 摘要:本文主要介绍使用kettle设计一些ETL任务时一些常见问题,这些问题大部分都不在官方FAQ上,你可以在kettle的论坛上找到一些问题的答案 1. J ...
- python实现atm机基本操作及购物车
一.需求分析 ATM机要为用户提供转账,提现,还款,付款,消费流水,操作记录等操作接口 ATM机要为管理员提供创建用户,冻结解冻,修改额度的功能 ATM机管理员认证使用装饰器来实现 购物车要提供管理员 ...
- 笨办法学Python - 习题4: Variables and Names
1.习题 4: 变量(variable)和命名 学习目标:了解Python中变量的定义,学习定义简明易记的变量名 变量:变量是存储内存中的值,就是每定义一个变量就会在内存中开辟一个空间.基于变量的类型 ...
- 安装配置php
安装PHP 1.安装PHP yum install php #根据提示输入Y直到安装完成 2.安装PHP组件,使PHP支持 MySQL.PHP支持FastCG ...
- final发布视频展示博客
Part One [探路者]选题展示视频链接: http://v.youku.com/v_show/id_XMzIxMDM2MTQ1Ng==.html?spm=a2h3j.8428770.341605 ...
- 第10章 系统级I/O(下)
10.7 I/O重定向 Unix外壳提供了I/O重定向操作符,允许用户将磁盘文件和标准输出输入联系起来. 例如:unix>ls>foo.txt,使得外壳加载和执行ls程序,将标准输出重定 ...
- Myeclipse(2014)项目的注释乱码
(之前都是在项目右键 propertits----resource---text file encoding 里面改成UTF-8的 下面是以后都直接换) window->preference-& ...