I don't really understand what you are trying to say. An accept() method in
the classes on which visitor operates is a standard, normal part of the
visitor pattern. Look at the examples in the wikipedia page you link to.  I
think the accept() method is necessary for compile time binding to work.

And RelShuttleImpl uses the RelNode.accept() method in the visitChild()
method. Wouldn't replacing the accept() method with visit(RelNode), which
is what I think you are suggesting, not have the correct dispatch?

On Thu, Dec 2, 2021 at 10:22 AM Vladimir Sitnikov <
sitnikov.vladi...@gmail.com> wrote:

> Steven>Agree with James, and that's not even including implementations in
> other
> Steven>codebases that use calcite (e.g. there are dozens of implementations
> in
> Steven>Dremio's codebase).
>
> Can you please show RelShuttle in Dremio codebase?
> I see no RelShuttle implementations:
> https://github.com/dremio/dremio-oss/search?q=relshuttle
>
> Note: RelShuttleImpl does not count since RelShuttleImpl does not really
> need RelNode cooperation.
> RelShuttleImpl just enumerates children of the relations, and it does not
> rely on accept(..) calls.
>
> It can do the very same thing without calling accept(this), so we can
> remove  RelNode#accept(RelNode) methods,
> and we can still get the same RelShuttleImpl.
> It can have a series of if (... instanceof) checks or a Map#get(getClass())
> or even https://github.com/forax/exotic#visitor---javadoc
>
> Vladimir
>

Reply via email to