You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Jesus Camachorodriguez <jc...@hortonworks.com> on 2015/03/12 00:30:48 UTC

Custom properties e.g. in cluster

Hello,

Is there a way already implemented in Calcite to register properties e.g. max memory size, max split size, in the cluster so they can be used all over the optimization process?

Thanks,
Jesús

Re: Custom properties e.g. in cluster

Posted by Jesus Camachorodriguez <jc...@hortonworks.com>.
Thanks Julian, I just tested it and it worked nicely.

Jesús


On 3/12/15, 12:42 AM, "Julian Hyde" <ju...@gmail.com> wrote:

>Yes, Context.
>
>You can create your own class containing a bundle of properties you
>are interested in, put an instance inside a Context (so that it gets
>returned if someone calls Context.unwrap(YourClass.class)) and pass
>that Context to your planner's constructor.
>
>It will be available via RelOptPlanner.getContext(), hence available
>in every RelNode (via cluster) and in every RelOptRuleCall.
>
>See interface org.apache.calcite.plan.Context,
>class org.apache.calcite.plan.Contexts.
>
>You could add a method to Contexts to chain several Context instances
>together, if it helps.
>
>Julian
>
>
>On Wed, Mar 11, 2015 at 4:30 PM, Jesus Camachorodriguez
><jc...@hortonworks.com> wrote:
>> Hello,
>>
>> Is there a way already implemented in Calcite to register properties
>>e.g. max memory size, max split size, in the cluster so they can be used
>>all over the optimization process?
>>
>> Thanks,
>> Jesús


Re: Custom properties e.g. in cluster

Posted by Julian Hyde <ju...@gmail.com>.
Yes, Context.

You can create your own class containing a bundle of properties you
are interested in, put an instance inside a Context (so that it gets
returned if someone calls Context.unwrap(YourClass.class)) and pass
that Context to your planner's constructor.

It will be available via RelOptPlanner.getContext(), hence available
in every RelNode (via cluster) and in every RelOptRuleCall.

See interface org.apache.calcite.plan.Context,
class org.apache.calcite.plan.Contexts.

You could add a method to Contexts to chain several Context instances
together, if it helps.

Julian


On Wed, Mar 11, 2015 at 4:30 PM, Jesus Camachorodriguez
<jc...@hortonworks.com> wrote:
> Hello,
>
> Is there a way already implemented in Calcite to register properties e.g. max memory size, max split size, in the cluster so they can be used all over the optimization process?
>
> Thanks,
> Jesús