Calcite - Optimizer (RelOptCluster)

Card Puncher Data Processing


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.

The optimizer uses for that:

  • a planner (rule,..)
  • and metadata information (Materialization, Indexes)

They are all defined in the environment object RelOptCluster.

The Planner rules transform expression trees using mathematical identities that preserve semantics.

Calcite optimizes queries by repeatedly applying planner rules to a relational expression. For example, filter early.

A cost model guides the process, and the planner engine generates an alternative expression that has the same semantics as the original but a lower cost.


Calcite optimize the query plan (ie rewrite it) in the Prepare statement class. See optimize function (L133)

Discover More
Card Puncher Data Processing
Calcite (Farrago, Optiq)

Calcite is a Java SQL Processing engine where the data storage is developed in plugin. Calcite is an open source cost based query optimizer and query execution framework. SQL Parser SQL Validation...
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 - Physical Plan

in calcite. The physical plan is the relation algebra expression that describe how to perform the operation on the data. It's the output of the optimizer Example of output of a physical_plan (There...
Card Puncher Data Processing
Calcite - Planner (RelOptPlanner)

org/apache/calcite/plan/package-infoPlan provides an optimizer interface (ie Defines interfaces for constructing rule-based optimizers of relational expressions) Frameworks...
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