calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Hyde <jh...@apache.org>
Subject Re: RelMetadataQuery is not pluggable?
Date Fri, 01 Apr 2016 15:39:42 GMT
RelOptCluster#setMetadataProvider is not deprecated. The process for setting metadata provider
is complicated right now. Maybe someone has the time and energy to simplify it.

Julian


> On Mar 29, 2016, at 1:35 AM, Ted Xu <frankxus@gmail.com> wrote:
> 
> Thanks Julian!
> 
> I managed to inject my code by setting a ThreadLocal attribute in
> RelMetadataQuery, as follows,
> 
> RelMetadataQuery.THREAD_PROVIDERS.set(
> JaninoRelMetadataProvider.of(new MyRelMetadataProvider()));
> 
> Now it works.
> 
> However, does that mean RelOptCluster#setMetadataProvider is deprecated?
> 
> On Tue, Mar 29, 2016 at 12:26 PM Julian Hyde <jhyde@apache.org> wrote:
> 
>> Did you take a look at https://issues.apache.org/jira/browse/CALCITE-1147
>> <https://issues.apache.org/jira/browse/CALCITE-1147>? It helps make
>> RelMetadataQuery pluggable.
>> 
>>> On Mar 28, 2016, at 9:21 PM, Ted Xu <frankxus@gmail.com> wrote:
>>> 
>>> Hi all,
>>> 
>>> After [CALCITE-604 <https://issues.apache.org/jira/browse/CALCITE-604>],
>> I
>>> found the methods of RelMetadataQuery is not pluggable. By 'pluggable', I
>>> mean RelMetadataQuery's behaviour can be re-defined by registering a
>>> RelMetadataProvider in RelOptCluster.
>>> 
>>> For example, if I defined a RelMetadataProvider as follows and register
>> it
>>> using RelOptCluster#setMetadataProvider,
>>> 
>>> public class MyRelMetadataProvider extends ChainedRelMetadataProvider {
>>> public MyRelMetadataProvider() {
>>>   super(
>>>       ImmutableList.of(
>>>           MyRelMdRowCount.SOURCE));
>>> }
>>> }
>>> 
>>> I expect RelMetadataQuery#getRowCount will invoke MyRelMdRowCount.SOURCE.
>>> However I noticed that after CALCITE-604 it always use
>>> DefaultRelMetadataProvider.
>>> 
>>> I do noticed an example of overriding RelMetadataQuery in
>> RelMetadataTest,
>>> but I guess by now I can only add metadata support rather than override
>>> existing metadata?
>>> 
>>> I'm not sure if I'm using it in the right way, please correct me if I'm
>>> wrong. Thanks!
>>> 
>>> Regards,
>>> Ted Xu.
>> 
>> 


Mime
View raw message