Thank you very much for your answer.
I'm reading source code these days, I'm a little confused about the "
JaninoRelMetadataProvider.revise()" method.
So I'd like to know the reason why invalidate all of the caches of HANDLERS
when adding a new RelNode class to ALL_RELS.

Jacques Nadeau <jacq...@apache.org> 于2022年1月16日周日 02:04写道:

> I should you produce a test case that represents the specific concern you
> have as opposed to proposing a snippet of code. I'm not sure what you
> propose is necessary. I think their is implicit expected logic that a
> revise should only influence an exception outcome, not a value outcome.
> Only value outcomes are cached so I don't see where there would be a
> problem.
>
> If you're revising value outcomes based on revise call (not just exception
> outcomes), I think you're probably breaking the expected contract. (I say
> think here because I don't think docs make this clear and wasn't the person
> that wrote the original code.)
>
> On Sat, Jan 15, 2022, 3:23 AM guangyuan wang <wangguangy...@apache.org>
> wrote:
>
> > Dear community
> >
> > Why should invalidate all of the caches of HANDLERS when adding a new
> > RelNode class in JaninoRelMetadataProvider.revise() method?
> >
> > The Codes are below:
> >
> > package org.apache.calcite.rel.metadata
> >
> > public class JaninoRelMetadataProvider implements RelMetadataProvider {
> >
> > synchronized <M extends Metadata, H extends MetadataHandler<M>> H revise(
> >
> >     Class<? extends RelNode> rClass, MetadataDef<M> def) {
> >   if (ALL_RELS.add(rClass)) {
> >     HANDLERS.invalidateAll();
> >   }
> >   //noinspection unchecked
> >   return (H) create(def);
> > }
> >
> > }
> >
>

Reply via email to