hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Somogyi (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HBASE-18368) Filters with OR does not work
Date Wed, 12 Jul 2017 09:52:00 GMT
Peter Somogyi created HBASE-18368:

             Summary: Filters with OR does not work
                 Key: HBASE-18368
                 URL: https://issues.apache.org/jira/browse/HBASE-18368
             Project: HBase
          Issue Type: Bug
          Components: Filters
    Affects Versions: 2.0.0, 3.0.0
            Reporter: Peter Somogyi
            Priority: Critical

Scan gives back incomplete list if multiple filters are combined with OR / MUST_PASS_ONE.
Using 2 FamilyFilters in a FilterList using MUST_PASS_ONE operator will give back results
for only the first Filter.

{code:java|title=Test code}
  public void testFiltersWithOr() throws Exception {
    TableName tn = TableName.valueOf("MyTest");
    Table table = utility.createTable(tn, new String[] {"cf1", "cf2"});

    byte[] CF1 = Bytes.toBytes("cf1");
    byte[] CF2 = Bytes.toBytes("cf2");

    Put put1 = new Put(Bytes.toBytes("0"));
    put1.addColumn(CF1, Bytes.toBytes("col_a"), Bytes.toBytes(0));

    Put put2 = new Put(Bytes.toBytes("0"));
    put2.addColumn(CF2, Bytes.toBytes("col_b"), Bytes.toBytes(0));

    FamilyFilter filterCF1 = new FamilyFilter(CompareFilter.CompareOp.EQUAL, new BinaryComparator(CF1));
    FamilyFilter filterCF2 = new FamilyFilter(CompareFilter.CompareOp.EQUAL, new BinaryComparator(CF2));

    FilterList filterList = new FilterList(FilterList.Operator.MUST_PASS_ONE);


    Scan scan = new Scan();

    ResultScanner scanner = table.getScanner(scan);


    for (Result rr = scanner.next(); rr != null; rr = scanner.next()) {

FilterList OR (2/2): [FamilyFilter (EQUAL, cf1), FamilyFilter (EQUAL, cf2)]

This message was sent by Atlassian JIRA

View raw message