About
Plan provides an optimizer interface (ie Defines interfaces for constructing rule-based optimizers of relational expressions)
Don't confound with the Frameworks Planner that is a utility tool for the query planning process
The planning process is extensible. You can add your own:
- planner rules (Rewrite rules, …)
- cost model,
- and statistics.
Articles Related
List
Volcano
The VolcanoPlanner is the default planner of Calcite. It's a CBO (Cost Based Optimizer) - It apply a set of rules to minimize the cost of executing a query.
It applies the rules iteratively, selecting the plan with the lowest cost on each iteration.
cost are provided by the relational expression
The optimization stops when the cost does not significantly improve after a number of iteration.
The Relational operators by default are logical operators (ie they don't have a specific implementation) Because the volcano operator is cost based, all logical operators must be converted to physical operators to calculate an estimated cost.
Each physical operator in Calcite has a calling convention which specifies how the query will actually be executed.
Hep
HepPlanner is a heuristic optimizer similar to Spark Optimizer.
- The HepPlanner applies a given set of rules until they no longer apply.
- It applies all matching rules until none can be applied
- An heuristic optimization is a faster optimization than cost-based optimization
- Risk of infinite recursion if the rules makes a change that they match.