@Test
  public void testRecursionIsNotObstructed() {

    // @formatter:off
    final RelNode basePlan = relBuilder
          .scan("t")
          .filter(
              and(relBuilder,
                or(relBuilder,
                    eq(relBuilder,"f1",1),
                    eq(relBuilder,"f1",2)
                    )
                ,
                or(relBuilder,
                    and(relBuilder,
                        or(relBuilder,
                            eq(relBuilder,"f2",1), eq(relBuilder,"f2",2)),
                        or(relBuilder,
                            eq(relBuilder,"f3",1), eq(relBuilder,"f3",2))
                        ),
                    and(relBuilder,
                        or(relBuilder,
                            eq(relBuilder,"f2",3),eq(relBuilder,"f2",4)),
                        or(relBuilder,
                            eq(relBuilder,"f3",3),eq(relBuilder,"f3",4))
                        )
                )
              ))
          .build();
    // @formatter:on

    planner.setRoot(basePlan);
    RelNode optimizedRelNode = planner.findBestExp();

    HiveFilter filter = (HiveFilter) optimizedRelNode;
    RexNode condition = filter.getCondition();
    System.out.println(condition);
    assertEquals("AND(IN($0, 1, 2), OR(AND(IN($1, 1, 2), IN($2, 1, 2)), "
            + "AND(IN($1, 3, 4), IN($2, 3, 4))))",
        condition.toString());
  }
Despite that extraction happen at a higher level; nested parts should also be handled
ql/src/test/org/apache/hadoop/hive/ql/optimizer/calcite/rules/TestHivePointLookupOptimizerRule.java