@Override
  public boolean matches(final RelOptRuleCall call) {
    TableScan scan = call.rel(0);
    return config.getTableOccurrences().getOrDefault(scan.getTable().getQualifiedName(), 0)
        <= config.referenceThreshold();
  }
Rule that removes CTEs from the plan by expanding the respective TableScans.
<p>The rule assumes that all materializations registered in the planner refer to CTEs.</p>
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/RemoveInfrequentCteRule.java