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 <raajay.v@gmail.com> 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
|