private RelNode removeSubqueries(RelNode basePlan, RelMetadataProvider mdProvider) {
      final HepProgramBuilder builder = new HepProgramBuilder();
      builder.addMatchOrder(HepMatchOrder.DEPTH_FIRST);
      builder.addRuleCollection(
          ImmutableList.of(HiveSubQueryRemoveRule.forFilter(conf), HiveSubQueryRemoveRule.forProject(conf)));
      return executeProgram(basePlan, builder.build(), mdProvider, null);
    }
Removes sub-queries (if present) from the specified query plan.
@return a new query plan without subquery expressions.
ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java