Skip to content

ikvmnet/calcite-dotnet

Repository files navigation

Apache Calcite for .NET

This repository provides .NET projects that expose Apache Calcite — the SQL parser, optimizer, and execution framework — through standard ADO.NET abstractions, powered by IKVM.

Packages

Apache.Calcite.Data · src/Apache.Calcite.Data

The core ADO.NET provider. Exposes CalciteConnection, CalciteCommand, CalciteDataReader, CalciteBatch, CalciteDataSource, CalciteProviderFactory, and CalciteConnectionStringBuilder so any .NET code that speaks DbConnection / DbCommand / DbDataReader can execute Calcite SQL.

The Calcite engine runs fully in-process via IKVM — no JDBC driver, no Avatica server, no extra process.

dotnet add package Apache.Calcite.Data

Apache.Calcite.Adapter.AdoNet · src/Apache.Calcite.Adapter.AdoNet

Federated query adapter that bridges Calcite to external ADO.NET data sources. Exposes any database reachable via DbProviderFactory or DbDataSource as a Calcite schema, with pushdown of filters, projections, joins, aggregations, sorts, and set operations.

Ships built-in metadata for SQL Server, SQLite, ODBC, OLE DB, and any INFORMATION_SCHEMA-compliant database.

dotnet add package Apache.Calcite.Adapter.AdoNet

Apache.Calcite.Extensions · src/Apache.Calcite.Extensions

.NET-friendly interop helpers. Provides CalciteConnectionProperties — a strongly-typed wrapper over Calcite's java.util.Properties — so you can configure the engine with compile-time-safe .NET properties instead of raw string keys.

dotnet add package Apache.Calcite.Extensions

Test and distribution projects

Project Purpose
Apache.Calcite.Tests Core engine integration tests
Apache.Calcite.Data.Tests Provider integration tests
Apache.Calcite.Adapter.AdoNet.Tests Adapter integration tests
dist-nuget Packages NuGet artifacts
dist-tests Packages test artifacts for CI

Quick example

using Apache.Calcite.Data;

const string model = """
{
  "version": "1.0",
  "defaultSchema": "HR",
  "schemas": [{
    "name": "HR",
    "type": "custom",
    "factory": "org.apache.calcite.adapter.csv.CsvSchemaFactory",
    "operand": { "directory": "hr" }
  }]
}
""";

await using var conn = new CalciteConnection($"Model=inline:{model}");
await conn.OpenAsync();

await using var cmd = conn.CreateCommand();
cmd.CommandText = "SELECT \"NAME\", \"DEPTNO\" FROM \"EMPS\" ORDER BY \"NAME\"";

await using var reader = await cmd.ExecuteReaderAsync();
while (await reader.ReadAsync())
    Console.WriteLine($"{reader.GetString(0)}\t{reader.GetInt32(1)}");

Further reading

License

Apache License 2.0.

About

ADO.NET Adapter and Driver for Apache Calcite

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages