Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Polymedia/calcite-test

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Calcite + ClickHouse (dialect) minimal optimization example

Prerequisites

  • Java Development Kit (JDK) 21 (LTS)

    • Windows suggested path: C:\Program Files\Java\jdk-21 (or similar jdk-21.x.x)
    • Verify:
      • PowerShell:
        java -version
        javac -version
      • If javac is missing, you installed a JRE instead of a JDK.
  • Apache Maven 3.8+ (обычно ставится вместе с IDE плагином, но лучше установить отдельно)

    • Verify:
      mvn -v
  • VS Code or Cursor with extensions:

    • Extension Pack for Java
    • Language Support for Java by Red Hat
    • Debugger for Java
    • Maven for Java
    • Project Manager for Java

Open the project in VS Code / Cursor

  1. Open Folder: open the project root (the folder containing pom.xml, src/, and .vscode/).
  2. Trust the workspace if asked (otherwise Java extensions run in Restricted Mode).
  3. Extensions will prompt to Import Maven Project — accept it.

Configure JDK 21 for IDE and build

Recommended: set JDK 21 in workspace settings so IntelliSense and debug use the same JDK.

Edit .vscode/settings.json (already present here):

{
  "java.configuration.updateBuildConfiguration": "automatic",
  "java.import.maven.enabled": true,
  "java.jdt.ls.java.home": "C:\\Program Files\\Java\\jdk-21",
  "java.configuration.runtimes": [
    { "name": "JavaSE-21", "path": "C:\\Program Files\\Java\\jdk-21", "default": true }
  ]
}

If your JDK path differs, adjust the path accordingly.

Additionally, this repo’s .vscode/launch.json and .vscode/tasks.json are configured to:

  • run mvn package automatically before debug
  • and enforce JAVA_HOME for debug launch if needed

Build and Run (Terminal)

PowerShell (Windows):

mvn -q -DskipTests package
mvn -q exec:java

Build and Debug (F5)

  1. Open src/main/java/io/example/calciteclickhouse/Main.java
  2. Set a breakpoint in main
  3. Press F5 and choose "Debug Main (CalciteTest)"
    • This will:
      • run Maven package as a preLaunchTask
      • start the app with the proper classpath
  4. When stopped on breakpoint, use the Run and Debug view (Ctrl+Shift+D) to inspect variables and call stack.

If you see "invalid target release: 21": Maven/Java runs under an older JDK. Either:

  • set system JAVA_HOME to JDK 21 and restart the IDE, or
  • set JDK 21 for the task/launch env (already configured in .vscode), or
  • temporarily set PowerShell env vars:
    $env:JAVA_HOME="C:\\Program Files\\Java\\jdk-21"
    $env:Path="$env:JAVA_HOME\\bin;$env:Path"

What the sample does

  • Parses SQL with Calcite, converts to RelNode
  • Runs a HepPlanner with rules (including a custom Filter→Project transpose rule)
  • Prints SQL before/after optimization

Change the demo SQL in Main.java to experiment with different queries and rules.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.