renamedForStar[0] = false;
renamedForStar[1] = false;
//root should be screen / writer : no need to rename for the root.
Prel child = ((Prel) root.getInput(0)).accept(INSTANCE, renamedForStar);
if (renamedForStar[0] && renamedForStar[1]) {
List<RexNode> exprs = Lists.newArrayList();
for (int i = 0; i < origRowType.getFieldCount(); i++) {
RexNode expr = child.getCluster().getRexBuilder().makeInputRef(origRowType.getFieldList().get(i).getType(), i);
exprs.add(expr);
}
RelDataType newRowType = RexUtil.createStructType(child.getCluster().getTypeFactory(), exprs, origRowType.getFieldNames());
// Insert a top project which allows duplicate columns.
child = new ProjectAllowDupPrel(child.getCluster(), child.getTraitSet(), child, exprs, newRowType);
List<RelNode> children = Lists.newArrayList();
children.add( child);
return (Prel) root.copy(root.getTraitSet(), children);