@Override
    public void onMatch(RelOptRuleCall call) {
      final Filter fil = call.rel(0);
      final TableScan rel = call.rel(1);
      // Add identity
      RelBuilder relBuilder = call.builder();
      relBuilder.push(rel);
      List<RexNode> identityFields = relBuilder.fields(
          ImmutableBitSet.range(0, rel.getRowType().getFieldCount()).asList());
      RelNode newRel = relBuilder
          .project(identityFields, ImmutableList.of(), true)
          .build();
      call.transformTo(fil.copy(fil.getTraitSet(), ImmutableList.of(newRel)));
    }
This rule inserts an identity Project operator on top of a TableScan.
The rule is useful to pull-up the projection expressions during partial
rewriting using Union operator, as we would like to have all those
expressions available at the top of the input to insert Filter conditions
if needed.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/views/HiveMaterializedViewRule.java