I like it as it is. A visitor pattern, of which RelShuttle is an embodiment, is basically a way to simulate multiple dispatch [ http://en.wikipedia.org/wiki/Multiple_dispatch ] in a single-dispatch language such as Java.
Visitors have several limitations: two calls for each dispatch; and doesn't handle addition of new sub-types. ReflectiveVisitor doesn't have those limitations. If your motivation is that you want to make the decorrelator more re-usable or extensible, I'd suggest that we put in the effort to make it more like a standard Calcite rule. Julian > On Nov 23, 2014, at 7:14 AM, Vladimir Sitnikov <[email protected]> > wrote: > > Hi, > > As I touch Correlate relations, I had to touch RelDecorrelator code. > I think I get the idea of that 3000 line thing, however I am not sure > what is the idea behind mapOldToNewRel. > > Am I right it would be better to express RelDecorrelator in terms of > some RelShuttle? > I think I would be able to pass with my LogicalCorrelate without major > changes to decorrelator. However I wonder if there are known pitfalls > (e.g. what kind of state is held in RelDecorrelator and if there are > state dependencies between different methods/etc). > > -- > Regards, > Vladimir Sitnikov
