Okay got it. Thanks a lot!

As a follow up, what would be the strategy to obtain multiple operator
trees while using a HepPlanner ? I am interested in HepPlanner because it
is used in Hive Extensively.

My understanding from reading the code for HepPlanner is that obtaining
alternate plans with higher cost might not be possible. Every node in the
graph contains only one RelNode (not notion of "best") and thus any
traversal will give only one plan.

Thanks,
Raajay

On Mon, Aug 10, 2015 at 4:29 PM, Julian Hyde <[email protected]> wrote:

> There isn’t an interface as such. But you could modify the code to achieve
> that behavior.
>
> All of the various plans are held in the graph of the VolcanoPlanner
> consisting of RelSet, RelSubset and RelNode objects.
> RelSubset.CheapestPlanReplacer walks over that graph finding the cheapest.
> It uses the RelSubset.best field but you could create a similar class that
> return all plans within K of the best cost.
>
> A few words of caution. Each path through the graph is another plan, and
> there is a huge number of combinations, and many of the combinations will
> be very similar to each other. You should keep the threshold small, and
> filter out plans that are not very different.
>
> Julian
>
>
> > On Aug 7, 2015, at 11:42 PM, Raajay <[email protected]> wrote:
> >
> > Hello,
> >
> > I am just starting to explore Calcite, especially related to its
> > application to Hive. As I understand it, Calcite takes as input the
> > following:
> >
> > 1. An SQL operator tree
> > 2. A set of rules (pattern based) that define alterations to the three
> > 3. A cost model for basic operations.
> >
> >
> > Given these, calcite explores the space of all possible alterations
> (based
> > on the rules) and returns the one with least cost. Is there an interface
> > for Calcite to return multiple Operator trees, say for example, all trees
> > with cost below a threshold ?
> >
> > If yes, pointers to it would be great.
> >
> > Thanks
> > Raajay
>
>

Reply via email to