public static RelNode copyNodeNewCluster(RelOptCluster optCluster, RelNode node) {
    if (node instanceof Filter) {
      final Filter f = (Filter) node;
      return new HiveFilter(optCluster, f.getTraitSet(),
          copyNodeNewCluster(optCluster, f.getInput()), f.getCondition());
    } else if (node instanceof Project) {
      final Project p = (Project) node;
      return HiveProject.create(optCluster, copyNodeNewCluster(optCluster, p.getInput()),
          p.getProjects(), p.getRowType(), Collections.emptyList());
    } else {
      return copyNodeScanNewCluster(optCluster, node);
    }
  }
Method that will recreate the plan rooted at node using the cluster given
as a parameter.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/views/HiveMaterializedViewUtils.java