Search in sources :

Example 1 with FILTERS

use of com.google.cloud.bigtable.data.v2.models.Filters.FILTERS in project java-bigtable-hbase by googleapis.

the class TestFilterListAdapter method interleavedFiltersAreAdapted.

@Test
public void interleavedFiltersAreAdapted() throws IOException {
    FilterList filterList = makeFilterList(Operator.MUST_PASS_ONE);
    List<Filter> filters = filterList.getFilters();
    Filters.Filter expectedFilter = adapt(filterList);
    Assert.assertEquals(filters.size(), expectedFilter.toProto().getInterleave().getFiltersCount());
    for (int i = 0; i < filters.size(); i++) {
        Assert.assertEquals(adapt(filters.get(i)).toProto(), expectedFilter.toProto().getInterleave().getFilters(i));
    }
}
Also used : Filters(com.google.cloud.bigtable.data.v2.models.Filters) ValueFilter(org.apache.hadoop.hbase.filter.ValueFilter) PrefixFilter(org.apache.hadoop.hbase.filter.PrefixFilter) QualifierFilter(org.apache.hadoop.hbase.filter.QualifierFilter) PageFilter(org.apache.hadoop.hbase.filter.PageFilter) Filter(org.apache.hadoop.hbase.filter.Filter) FilterList(org.apache.hadoop.hbase.filter.FilterList) Test(org.junit.Test)

Example 2 with FILTERS

use of com.google.cloud.bigtable.data.v2.models.Filters.FILTERS in project java-bigtable-hbase by googleapis.

the class TestFilterListAdapter method chainedFiltersAreAdapted.

@Test
public void chainedFiltersAreAdapted() throws IOException {
    FilterList filterList = makeFilterList(Operator.MUST_PASS_ALL);
    List<Filter> filters = filterList.getFilters();
    Filters.Filter expectedFilter = adapt(filterList);
    Assert.assertEquals(filters.size(), expectedFilter.toProto().getChain().getFiltersCount());
    for (int i = 0; i < filters.size(); i++) {
        Assert.assertEquals(adapt(filters.get(i)).toProto(), expectedFilter.toProto().getChain().getFilters(i));
    }
}
Also used : Filters(com.google.cloud.bigtable.data.v2.models.Filters) ValueFilter(org.apache.hadoop.hbase.filter.ValueFilter) PrefixFilter(org.apache.hadoop.hbase.filter.PrefixFilter) QualifierFilter(org.apache.hadoop.hbase.filter.QualifierFilter) PageFilter(org.apache.hadoop.hbase.filter.PageFilter) Filter(org.apache.hadoop.hbase.filter.Filter) FilterList(org.apache.hadoop.hbase.filter.FilterList) Test(org.junit.Test)

Example 3 with FILTERS

use of com.google.cloud.bigtable.data.v2.models.Filters.FILTERS in project java-bigtable-hbase by googleapis.

the class TestKeyOnlyFilterAdapter method stripValuesIsApplied.

@Test
public void stripValuesIsApplied() throws IOException {
    KeyOnlyFilter filter = new KeyOnlyFilter();
    Filters.Filter expectedFilter = filterAdapter.adapt(emptyScanContext, filter);
    Chain chain = expectedFilter.toProto().getChain();
    Assert.assertTrue(chain.getFilters(0).getStripValueTransformer() || chain.getFilters(1).getStripValueTransformer());
    Filters.Filter filters = filterAdapter.adapt(emptyScanContext, filter);
    Filters f = Filters.FILTERS;
    Assert.assertEquals(filters.toProto(), f.chain().filter(f.limit().cellsPerColumn(1)).filter(f.value().strip()).toProto());
}
Also used : Chain(com.google.bigtable.v2.RowFilter.Chain) KeyOnlyFilter(org.apache.hadoop.hbase.filter.KeyOnlyFilter) Filters(com.google.cloud.bigtable.data.v2.models.Filters) Test(org.junit.Test)

Aggregations

Filters (com.google.cloud.bigtable.data.v2.models.Filters)3 Test (org.junit.Test)3 Filter (org.apache.hadoop.hbase.filter.Filter)2 FilterList (org.apache.hadoop.hbase.filter.FilterList)2 PageFilter (org.apache.hadoop.hbase.filter.PageFilter)2 PrefixFilter (org.apache.hadoop.hbase.filter.PrefixFilter)2 QualifierFilter (org.apache.hadoop.hbase.filter.QualifierFilter)2 ValueFilter (org.apache.hadoop.hbase.filter.ValueFilter)2 Chain (com.google.bigtable.v2.RowFilter.Chain)1 KeyOnlyFilter (org.apache.hadoop.hbase.filter.KeyOnlyFilter)1