Open
Conversation
cc01b31 to
cb3edb2
Compare
Implements end-to-end SQL query pipeline for simple SELECT queries:
Compile-time: MergedSelectionMap → DataFusion LogicalPlan → Substrait binary
Runtime: Substrait plan → isograph-server execution → Arrow IPC response
New components:
- crates/sql_network_protocol: NetworkProtocol impl; LogicalPlan builder and
Substrait serialization; parses SQL schema into Isograph's type model
- crates/sql_lang_types, crates/sql_schema_parser: SQL-specific language types
and DDL parser
- crates/isograph_server: Axum HTTP server with /query endpoint
- demos/sqlite-demo: end-to-end Vite+React demo using Star Wars planets SQLite
- test-fixtures/databases: SQLite schema and init scripts for Phase 1–3
- E2E Playwright tests for the full pipeline
Type system: widen NetworkResponseObject from branded-key mapped type to plain
string index signature so SQL-generated types (e.g. { id: number, name: string })
satisfy the constraint without @ts-ignore. SQL numeric IDs accepted via
id?: DataId | number. Zero breaking change for existing GraphQL code.
Compiler: add readonly modifiers and field-name quoting to SQL-generated
raw_response_type.ts files.
Build fixes: update swc workspace deps for serde 1.0.220+ compatibility,
fix clippy needless_return, add protoc to CI for substrait code generation,
update pnpm lockfile, fix prettier and oxlint issues.
Co-Authored-By: Claude <noreply@anthropic.com>
cb3edb2 to
fd8e190
Compare
- Add Cross.toml: installs protobuf-compiler inside the cross Docker containers used for Linux ARM64 builds (substrait/prost-build requires protoc at compile time, and the cross images don't include it) - Increase build-cli timeout from 15 → 45 minutes: adding substrait + DataFusion to the workspace significantly increases compile time on Windows and macOS ARM64 runners Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Uses Swatinem/rust-cache@v2 with: - Per-target shared-key so Linux/macOS/Windows caches don't collide - cache-on-failure: true so timed-out or failed builds still populate the cache for the next run (critical for the slow Windows/macOS ARM64 targets that were hitting the 15-minute timeout) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Two fixes: 1. Move timeout-minutes: 45 to ci.yml caller jobs — GitHub Actions ignores timeout-minutes in called reusable workflows; it must be set in the caller. The 15-min limit in build-cli.yml was never being overridden by our change there. 2. Install protoc 25.3 from GitHub releases in Cross.toml instead of apt's bundled version — the cross Docker image ships protoc < 3.15 which rejects the `optional` keyword in proto3 syntax used by the substrait .proto files. Protoc 25.x supports it. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This branch adds Phase 1 SQL support to Isograph using DataFusion and Substrait, enabling Isograph to execute SQL queries against SQLite databases via a compile-time query pipeline, and fixes the TypeScript type system to support both SQL and GraphQL response types.
What Was Built
1. SQL Query Pipeline (compile-time)
Isograph's compiler now generates a Substrait binary query plan alongside the existing GraphQL artifacts. The pipeline is:
New crates:
crates/sql_network_protocol—NetworkProtocolimplementation for SQL; builds DataFusionLogicalPlanfrom Isograph'sMergedSelectionMap, then serialises to Substrait binary viaprostcrates/sql_lang_types— Type aliases and newtypes for SQL-specific language constructscrates/sql_schema_parser— Parses SQLCREATE TABLEDDL into Isograph's schema modelcrates/isograph_server— Axum HTTP server (/queryendpoint) that accepts Substrait plans at runtime, executes them against DataFusion, and returns Arrow IPC dataModified:
crates/artifact_content/src/entrypoint_artifact.rs— generatesquery_plan.bin(base64 Substrait) for SQL profilescrates/artifact_content/src/raw_response_type.rs— addsreadonlymodifiers and field-name quoting to generated TypeScript types2. SQLite Demo (
demos/sqlite-demo)A standalone Vite + React app that uses the SQL pipeline end-to-end:
schema.sqlisoto write aHomePageentrypoint that selectsid, name, climate, orbital_period, surface_waterquery_plan.bin,normalization_ast.ts, andraw_response_type.tsisograph-server, which runs the Substrait plan against DataFusion and returns Arrow IPC3. TypeScript Type System Unification
Problem: SQL-generated types like
{ id: number, name: string }didn't satisfy the existingNetworkResponseObjectconstraint, which used a branded-key mapped type designed only for GraphQL.Solution: Widened
NetworkResponseObjectinlibs/isograph-react/src/core/cache.tsto use a plain string index signature:This is zero-breaking-change: GraphQL types still satisfy the wider constraint due to TypeScript structural typing.
4. CI and Build Fixes
substrait 0.62transitively pulled inserde 1.0.220+which brokeswc_common 2.0.1. Fixed by updating swc workspace deps to versions compatible with the new serde.needless_return: CI runs withRUSTFLAGS=-D warnings; removed the redundantreturnstatement that was failing the build.@playwright/testtosqlite-demo/package.jsonwithout updating the lockfile; fixed by runningpnpm install.protoc; added installation to the CIcargo-testandcargo-clippyjobs.App.tsx.5. Test Fixtures and E2E Tests
test-fixtures/databases/— SQLite schema and init scripts for Phase 1–3 test progressiondemos/sqlite-demo/e2e/phase1-sql.spec.ts— Playwright E2E tests validating:isograph-server/queryendpoint is calledKey Files
crates/sql_network_protocol/src/sql_network_protocol.rsNetworkProtocolimpl for SQLcrates/sql_network_protocol/src/query_generation/logical_plan_builder.rsMergedSelectionMap→ DataFusionLogicalPlancrates/sql_network_protocol/src/substrait/serialize.rsLogicalPlan→ Substrait binarycrates/isograph_server/src/main.rscrates/artifact_content/src/entrypoint_artifact.rsquery_plan.bincrates/artifact_content/src/raw_response_type.rslibs/isograph-react/src/core/cache.tsNetworkResponseObjecttype wideningdemos/sqlite-demo/test-fixtures/databases/What Phase 1 Does NOT Include (Future Phases)
WHERE clauses / filtering (Phase 2)
JOINs / linked fields (Phase 3)
Mutations (Phase 4)
Subscriptions / live queries (Phase 5)
Connection pooling (isograph-server currently opens a new connection per request)