Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-18410 FilterList Improvement.
  3. HBASE-18368

FilterList with multiple FamilyFilters concatenated by OR does not work.

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 3.0.0-alpha-1, 2.0.0-alpha-1
    • Fix Version/s: None
    • Component/s: Filters
    • Labels:
      None
    • Hadoop Flags:
      Incompatible change

      Description

      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.

      Test code
        @Test
        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));
          table.put(put1);
      
          Put put2 = new Put(Bytes.toBytes("0"));
          put2.addColumn(CF2, Bytes.toBytes("col_b"), Bytes.toBytes(0));
          table.put(put2);
      
          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);
      
          filterList.addFilter(filterCF1);
          filterList.addFilter(filterCF2);
      
          Scan scan = new Scan();
          scan.setFilter(filterList);
      
          ResultScanner scanner = table.getScanner(scan);
      
          System.out.println(filterList);
      
          for (Result rr = scanner.next(); rr != null; rr = scanner.next()) {
            System.out.println(rr);
          }
        }
      
      Output
      FilterList OR (2/2): [FamilyFilter (EQUAL, cf1), FamilyFilter (EQUAL, cf2)]
      keyvalues={0/cf1:col_a/1499852754957/Put/vlen=4/seqid=0}
      

        Attachments

        1. HBASE-18368.branch-1.patch
          2 kB
          Allan Yang
        2. HBASE-18368.branch-1.v2.patch
          2 kB
          Allan Yang
        3. HBASE-18368.branch-1.v3.patch
          2 kB
          Allan Yang
        4. HBASE-18368.patch
          5 kB
          Allan Yang
        5. HBASE-18368.v2.patch
          10 kB
          Zheng Hu
        6. HBASE-18368.v3.patch
          37 kB
          Zheng Hu
        7. HBASE-18368.v3.patch
          38 kB
          Zheng Hu
        8. HBASE-18368-HBASE-18410.v1.patch
          6 kB
          Zheng Hu
        9. HBASE-18368-HBASE-18410.v2.patch
          7 kB
          Zheng Hu
        10. HBASE-18368-HBASE-18410.v2.patch
          7 kB
          Zheng Hu
        11. next-row-behavior-in-regionScanner-and-storeScanner.jpg
          25 kB
          Zheng Hu

          Issue Links

            Activity

              People

              • Assignee:
                openinx Zheng Hu
                Reporter:
                psomogyi Peter Somogyi
              • Votes:
                0 Vote for this issue
                Watchers:
                13 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: