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 Code - parse sql, validate, transform to relation expression and execute with a Planner
-
HelloWorld of the official documentation
- HelloWorld Code - A query (The first demo of the doc)
- Reflective Schema - Shows how to create a schema from Java Object via reflexion
- Catalog Reader - read the schema and tables from a catalog
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:
- 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.
- 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
- This code is an extract and adaptation of the test core project of calcite.
- The database used are
Hsqldb
andH2
and the data files such asSCOTT
are also in a jar dependency file.