@Override
  public List<RelNode> suggest(final RelNode input, final Configuration configuration) {
    CommonTableExpressionRegistry localRegistry = new CommonTableExpressionRegistry();
    HepProgram ruleProgram = new HepProgramBuilder()
        .addRuleInstance(CommonRelSubExprRegisterRule.JOIN)
        .addRuleInstance(CommonRelSubExprRegisterRule.AGGREGATE)
        .addRuleInstance(CommonRelSubExprRegisterRule.FILTER)
        .addRuleInstance(CommonRelSubExprRegisterRule.PROJECT)
        .build();
    HepPlanner planner = new HepPlanner(ruleProgram, Contexts.of(localRegistry));
    planner.setRoot(input);
    planner.findBestExp();
    return localRegistry.entries().collect(Collectors.toList());
  }
Suggester for common table expressions that appear as is (identical trees) more than once in the query plan.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/CommonTableExpressionIdentitySuggester.java