@Test
  public void testTransformMPO() throws Exception {
    // Apply the following filter:
    // (family=fam AND qualifier=qual1 AND KeyOnlyFilter)
    // OR (family=fam AND qualifier=qual2)
    final FilterList flist = new FilterList(Operator.MUST_PASS_ONE,
      Lists.<Filter> newArrayList(
        new FilterList(Operator.MUST_PASS_ALL,
          Lists.<Filter> newArrayList(
            new FamilyFilter(CompareOperator.EQUAL, new BinaryComparator(Bytes.toBytes("fam"))),
            new QualifierFilter(CompareOperator.EQUAL,
              new BinaryComparator(Bytes.toBytes("qual1"))),
            new KeyOnlyFilter())),
        new FilterList(Operator.MUST_PASS_ALL,
          Lists.<Filter> newArrayList(
            new FamilyFilter(CompareOperator.EQUAL, new BinaryComparator(Bytes.toBytes("fam"))),
            new QualifierFilter(CompareOperator.EQUAL,
              new BinaryComparator(Bytes.toBytes("qual2")))))));

    final KeyValue kvQual1 = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("fam"),
      Bytes.toBytes("qual1"), Bytes.toBytes("value"));
    final KeyValue kvQual2 = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("fam"),
      Bytes.toBytes("qual2"), Bytes.toBytes("value"));
    final KeyValue kvQual3 = new KeyValue(Bytes.toBytes("row"), Bytes.toBytes("fam"),
      Bytes.toBytes("qual3"), Bytes.toBytes("value"));

    // Value for fam:qual1 should be stripped:
    assertEquals(Filter.ReturnCode.INCLUDE, flist.filterCell(kvQual1));
    final KeyValue transformedQual1 =
      KeyValueUtil.ensureKeyValue((ExtendedCell) flist.transformCell(kvQual1));
    assertEquals(0, transformedQual1.getValueLength());

    // Value for fam:qual2 should not be stripped:
    assertEquals(Filter.ReturnCode.INCLUDE, flist.filterCell(kvQual2));
    final KeyValue transformedQual2 =
      KeyValueUtil.ensureKeyValue((ExtendedCell) flist.transformCell(kvQual2));
    assertEquals("value", Bytes.toString(transformedQual2.getValueArray(),
      transformedQual2.getValueOffset(), transformedQual2.getValueLength()));

    // Other keys should be skipped:
    assertEquals(Filter.ReturnCode.SKIP, flist.filterCell(kvQual3));
  }
Tests the behavior of transform() in a hierarchical filter. transform() only applies after a
filterCell() whose return-code includes the KeyValue. Lazy evaluation of AND
hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFilterList.java