calcite icon indicating copy to clipboard operation
calcite copied to clipboard

Calcite Demo

Calcite Demo's

Build Status

About

A repository of Calcite demo's

Note: This demos are using a lot of Reflective Schema (ie schema in the code) but in practice, you would connect to a data store (database, adapter) to get a schema.

Getting Started Demos

Demo Schema and Catalog

  • Reflective Schema - Shows how to create a schema from Java Object via reflexion
  • Catalog Reader - read the schema and tables from a catalog

Demo Sql Parsing and validation

Select Statement:

  • Sql Select Info - Parse a Select Sql and extracts tokens
  • Sql Select Visitor - Parse a Select Sql and build the tree (SqlNode) and visit it
  • Sql Pretty Print - Parse a SQL to SqlNode and print it pretty
  • Sql Validation - Parse a SQL to SqlNode and validate it

There is also other node type:

Demo Logical Relational Expression

  • Relational Logical Expression - shows how to create several relational logical expression, print the sql and execute them
  • Relational Expression from Jdbc Schema From RelBuilder based on a Jdbc data store, build a relational expression and transform it to SQL.

Demo Optimization / Cost

  • Relational Expression Optimization with the HepPlanner - shows the filter early optimization
  • Relational Expression Optimization with the Volcano Planner (and cost) - optimization with the Volcano Planner

FYI

  • This code is an extract and adaptation of the test core project of calcite.
  • The database used are Hsqldb and H2 and the data files such as SCOTT are also in a jar dependency file.

Doc / Reference