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

来源:互联网 发布:js math 编辑:程序博客网 时间:2024/05/29 19:00

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); 


原创粉丝点击