Right now, RelNode's accept method and RelShuttle forces a user to return RelNodes. This makes tree traversal/conversion extra painful in main circumstances (you want to have more specific relnode classes explicit, you want to rewrite to non-relnodes, etc). I've worked around this for many years but really think it should be resolved inside Calcite. I wanted to get some feedback on introducing a more generic pattern (that RelShuttle becomes a concrete variation of). If people are on board with the change, I'll pull it through the codebase.
You can see the rough idea in this wip patch: https://github.com/apache/calcite/pull/2625 Basically, introduce a new parameterized visitor that people can use. This doesn't change the existing behavior of RelShuttle (it's now just a specific version of this generic version) but it does allow other rewrite patterns. Thoughts?
