This makes sense, however then we need to do something with .copy methods.
I believe, it should always create a new copy no matter what the
"input" values are and update javadocs accordingly.

Note how
org.apache.calcite.sql2rel.RelDecorrelator#decorrelateRelGeneric
and
org.apache.calcite.sql2rel.RelStructuredTypeFlattener#rewriteGeneric
both use the following dubious approach:
1) RelNode newRel = rel.copy(rel.getTraitSet(), rel.getInputs());
2) newRel.replaceInput(...)
It looks like the intention was to keep the original rel intact,
however it fails if the .copy() is a no-op.

Vladimir

Reply via email to