SingleColumnValueFilter 过滤数据时候,返回的数据不正常问题

SingleColumnValueFilter 过滤数据时候,返回的数据不正常问题 

这是因为 忽略了SingleColumnValueFilter 的一个参数问题。

hbase 权威指南文档原文:

The filter class also exposes a few auxiliary methods you can use to
fine tune its behavior:
boolean getFilterIfMissing()
void setFilterIfMissing(boolean filterIfMissing)
boolean getLatestVersionOnly()
void setLatestVersionOnly(boolean latestVersionOnly)
The former controls what happens to rows that do not have the
column at all. By default they are included in the result, but you can
use setFilterIfMissing(true) to reverse that behavior, i.e., all
rows that do not have the reference column are dropped from the
result.
266
Note
You must include the column you want to filter by, i.e., the reference
column, into the families you query for - using addColumn() for
example. If you fail to do so the column is considered missing and the
result is either empty, or contains all rows, based on the
getFilterIfMissing() result.


 设置SingleColumnValueFilter时候注意的地方:
要过滤的列必须存在,如果不存在,那么这些列不存在的数据也会返回。如果不想让这些数据返回,做如下设置即可。
filter.setFilterIfMissing(true); 


  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值