Skip to content

ADR-0011 — Use sqlparser for SQL Virtual Tables

Status

Accepted (supersedes ADR-0004 for v0.1–v0.2)

Context

OntoIndex exposes ontology catalog data as SQL-queryable virtual tables. ADR-0004 proposed evaluating DataFusion; the MVP needed a lightweight SELECT/FROM/WHERE path without pulling the full Arrow/DataFusion stack.

Decision

Implement SQL-like queries with the sqlparser crate and hand-rolled virtual table projection in ontoindex-query.

Consequences

Positive:

  • Small dependency footprint
  • Straightforward mapping from catalog structs to rows
  • Easy to document the supported SQL subset

Negative:

  • Limited SQL (single table, simple filters in v0.2)
  • No Arrow/Parquet integration until v1.0 joins evaluation

Amendment (ADR-0016 Appendix B)

v1.0 joins / aggregations: extend hand-rolled virtual tables in ontoindex-query using sqlparser AST first.

Revisit ADR-0004 / DataFusion only if: join logic exceeds maintainability, Parquet/Arrow export becomes P0, or aggregations need a query optimizer beyond hand-rolled plans.

Record final choice in DEPENDENCY_MATRIX.md.

Implementation

See sql.rs on GitHub and sql-reference.md.