Hbase的过滤器分类(1)

比较过滤器

1.1 行键过滤器RowFilter
Filter filter1 = new RowFilter(CompareOp.LESS_OR_EQUAL, new BinaryComparator(Bytes.toBytes(“row-22”)));
scan.setFilter(filter1);

1.2 列族过滤器FamilyFilter
Filter filter1 = new FamilyFilter(CompareFilter.CompareOp.LESS, new BinaryComparator(Bytes.toBytes(“colfam3”)));
scan.setFilter(filter1);

1.3 列过滤器QualifierFilter
filter = new QualifierFilter(CompareFilter.CompareOp.LESS_OR_EQUAL, new BinaryComparator(Bytes.toBytes(“col-2”)));
scan.setFilter(filter1);

1.4 值过滤器 ValueFilter
Filter filter = new ValueFilter(CompareFilter.CompareOp.EQUAL, new SubstringComparator(“.4”) );
scan.setFilter(filter1);

 专用过滤器
2.1 单列值过滤器 SingleColumnValueFilter —-会返回满足条件的整行
SingleColumnValueFilter filter = new SingleColumnValueFilter(
Bytes.toBytes(“colfam1”),
Bytes.toBytes(“col-5”),
CompareFilter.CompareOp.NOT_EQUAL,
new SubstringComparator(“val-5”));
filter.setFilterIfMissing(true); //如果不设置为true,则那些不包含指定column的行也会返回
scan.setFilter(filter1);

2.2 SingleColumnValueExcludeFilter
与上相反

2.3 前缀过滤器 PrefixFilter—-针对行键
Filter filter = new PrefixFilter(Bytes.toBytes(“row1”));
scan.setFilter(filter1);

2.4 列前缀过滤器 ColumnPrefixFilter
Filter filter = new ColumnPrefixFilter(Bytes.toBytes(“qual2”));
scan.setFilter(filter1);

你可能感兴趣的:(hbase)