hi Danny,

I didn't mention, but I use calcite 1.21.0.

have attempted to use the function already with no success; it didn't seem
to actually change the provider.
have used the RelMetadataQuery.THREAD_PROVIDERS directly and it worked
perfectly.

i assume it is because the function RelOptCluster#setMetadataProvider
- in 1.21.0 doesn't use THREAD_PROVIDERS; ([1])
- in master it does use THREAD_PROVIDERS; ([2])

will upgrade to 1.24.0 when it is released and will attempt again.

[1]
https://github.com/apache/calcite/blob/adc1532de853060d24fd0129257a3fae306fb55c/core/src/main/java/org/apache/calcite/plan/RelOptCluster.java#L135
[2]
https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/plan/RelOptCluster.java#L142

On Tue, Jul 21, 2020 at 11:45 AM Danny Chan <[email protected]> wrote:

> The suggested way to set up the RelMetadataProvider is through
> RelOptCluster#setMetadataProvider [1]. If you want to customize the
> RelMetadataQuery, take the document in RelMetadataQueryBase [2] for a
> reference.
>
> [1]
> https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/plan/RelOptCluster.java#L142
> [2]
> https://github.com/apache/calcite/blob/d2c859098acb3210ac5cad90c5ea28a3317f0386/core/src/main/java/org/apache/calcite/rel/metadata/RelMetadataQueryBase.java#L58
>
> Best,
> Danny Chan
> 在 2020年7月21日 +0800 PM4:18,Tal Glanzman <[email protected]>,写道:
> > thank you it is working great!
> >
> > On Tue, Jul 21, 2020 at 12:45 AM Stamatis Zampetakis <[email protected]>
> > wrote:
> >
> > > Hi Taz,
> > >
> > > If you are relying on the RelMetadataQuery [1] API then you may need
> to set
> > > your provided into THREAD_PROVIDERS in a similar way that it is done in
> > > RelMetadataTest [2].
> > >
> > > Best,
> > > Stamatis
> > >
> > > [1]
> > >
> > >
> https://github.com/apache/calcite/blob/7a462f2b2f78aa12068b691c1e423ea4c8a825e4/core/src/main/java/org/apache/calcite/rel/metadata/RelMetadataQuery.java#L75
> > > [2]
> > >
> > >
> https://github.com/apache/calcite/blob/7a462f2b2f78aa12068b691c1e423ea4c8a825e4/core/src/test/java/org/apache/calcite/test/RelMetadataTest.java#L893
> > >
> > > On Mon, Jul 20, 2020 at 6:15 PM Tal Glanzman <[email protected]>
> > > wrote:
> > >
> > > > hi,
> > > >
> > > > I am trying to figure out how to add custom logic for providing
> metadata
> > > to
> > > > nodes inside my adapter with no luck.
> > > >
> > > > I have an implementation of my own RelMetadataProvider, as described
> in
> > > the
> > > > docs.
> > > >
> > > > After looking around, i still couldn't find a way to use this
> provider in
> > > > the planning phase
> > > > - no property in the jdbc connection string
> > > > - tried to invoke setMetadataProvider(provider) on the cluster of the
> > > > initial nodes of the tree
> > > >
> > > > drilling a bit, i notice that the provider in use is
> > > > JaninoRelMetadataProvider with provider=DefaultRelMetadataProvider.
> > > >
> > > > Is there a way to do such a thing using the standard execution?
> > > >
> > > > any guidance will be much appreciated, thanks!
> > > >
> > >
>

Reply via email to