0

In Calcite, after optimization provided by the default VolcanoPlanner, we can get an optimized RelNode, but can we have a further optimization? For example I want to add an ElasticsearchSort or something like that to limit the dataset we handle.

Someone suggests we can define a RelOptRule, but since VolcanoPlanner handles the optimization in dynamic programming way, not sure if the rule can be applied in the right order. Any ideas?

jerryleooo
  • 843
  • 10
  • 16
  • Can you explain your concern about the rule application order of the VolcanoPlanner? A custom RelOptRule can determine whether it matches a specific query plan subgraph which is often sufficient in my experience – Mzzzzzz Mar 14 '20 at 16:23
  • What I want to add to the SQL is "LIMIT" clause, I guess I need to add it at the last step, since if added in intermediate steps the query plan may be incorrect. – jerryleooo Mar 16 '20 at 03:27

1 Answers1

0

You don't have to use VolcanoPlanner. There's also HepPlanner which just applies the rules that you give it as a HepProgram.

Michael Mior
  • 28,107
  • 9
  • 89
  • 113