Calcite - Planner (RelOptPlanner)

Card Puncher Data Processing


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:



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.


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.


Documentation / Reference

Discover More
Calcite Converter Rule
Calcite - (Planner) Rule (RelOptRule)

A rule is used to modified a relational expression (ie query plan) They are used by the planner to: optimize or modify relational algebra expressions (ie query plan). Every rule extends org/apache/calcite/plan/RelOptRuleRelOptRule...
Card Puncher Data Processing
Calcite - Getting Started (from Sql to Resultset)

A getting started page that shows a query planning process (ie from sql to resultset process) gerardnico/calcite/blob/master/src/test/java/com/gerardnico/calcite/
Card Puncher Data Processing
Calcite - Logical Plan (Logical algebra)

in Calcite A logical plan is a relational expression with only logical operator. Logical algebra has no implementation of the relational operator and therefore can't run. The logical plan is the first...
Card Puncher Data Processing
Calcite - Optimizer (RelOptCluster)

The optimizer is a program that takes a relational expression (query plan) and rewrites it with optimization rules. The output is still a relational expression and is generally called the physical plan....
Card Puncher Data Processing
Calcite - Query Cost

in calcite. Calcite applies a Cost based optimizer by default that is called the Volcano planner. The cost is provided by the relational expression (relNode). See Cost is represented by org/apache/calcite/plan/RelOptCostRelOptCost...
Card Puncher Data Processing
Calcite - Query Planning Process (Sql Processing)

in Calcite The query planning process is the entire process that takes a SQL to a result. The process can be resumed as follow: Phase 1: The Sql statement (Query) is parsed to build a parse tree...
Card Puncher Data Processing
Calcite - Relational Expression (RelNode, Algebra)

Relational Algebra in Calcite A relational expression is represented by a tree of RelNode. A RelNode can be considered as the same logic than the Spark dataframe. TableScan Project Filter...

Share this page:
Follow us:
Task Runner