use crate::ast::dialect::{SupportEvidence, SupportTier};
use crate::dialect::BuiltinDialect;
impl BuiltinDialect {
pub const fn support_tier(self) -> SupportTier {
match self {
Self::Ansi => SupportTier::Stable,
#[cfg(feature = "postgres")]
Self::Postgres => SupportTier::Stable,
#[cfg(feature = "quiltdb")]
Self::QuiltDb => SupportTier::Stable,
#[cfg(feature = "mysql")]
Self::MySql => SupportTier::Stable,
#[cfg(feature = "sqlite")]
Self::Sqlite => SupportTier::Stable,
#[cfg(feature = "duckdb")]
Self::DuckDb => SupportTier::Stable,
#[cfg(feature = "clickhouse")]
Self::ClickHouse => SupportTier::Preview,
#[cfg(feature = "bigquery")]
Self::BigQuery => SupportTier::Preview,
#[cfg(feature = "lenient")]
Self::Lenient => SupportTier::Preview,
#[cfg(feature = "hive")]
Self::Hive => SupportTier::Experimental,
#[cfg(feature = "databricks")]
Self::Databricks => SupportTier::Experimental,
#[cfg(feature = "mssql")]
Self::Mssql => SupportTier::Experimental,
#[cfg(feature = "snowflake")]
Self::Snowflake => SupportTier::Experimental,
#[cfg(feature = "redshift")]
Self::Redshift => SupportTier::Experimental,
}
}
pub const fn support_evidence(self) -> SupportEvidence {
match self {
Self::Ansi => SupportEvidence::StandardReference {
note: "ISO/IEC 9075:2016 baseline, held by the structural round-trip property \
(parse(render(x)) == x), the sqllogictest accept corpus, and a documented \
PostgreSQL nearest-engine delta ledger (oracle-parity-ansi)",
},
#[cfg(feature = "postgres")]
Self::Postgres => SupportEvidence::EngineDifferential {
engine: "libpg_query",
version: "pg_query 6.1.1 (PostgreSQL 17)",
method: "raw-parse-tree differential over the vendored corpus (ParseOnly)",
},
#[cfg(feature = "quiltdb")]
Self::QuiltDb => SupportEvidence::ContractGate {
artifact: "conformance/corpus/quiltdb/manifest.json",
note: "first-party QuiltDB parser contract: vendored stable-ID SQLLogicTest and integration-test corpora plus explicit accept/reject and structural round-trip gates",
},
#[cfg(feature = "mysql")]
Self::MySql => SupportEvidence::EngineDifferential {
engine: "mysql",
version: "8.4.10",
method: "live-server prepare + parse differential (oracle-mysql)",
},
#[cfg(feature = "sqlite")]
Self::Sqlite => SupportEvidence::EngineDifferential {
engine: "sqlite",
version: "rusqlite 0.40 (bundled SQLite)",
method: "in-process prepare differential (oracle-engines)",
},
#[cfg(feature = "duckdb")]
Self::DuckDb => SupportEvidence::EngineDifferential {
engine: "libduckdb",
version: "1.5.4",
method: "in-process extract_statements differential (oracle-engines)",
},
#[cfg(feature = "clickhouse")]
Self::ClickHouse => SupportEvidence::EngineDifferential {
engine: "clickhouse-local",
version: "25.5.1",
method: "external-process EXPLAIN AST over a partial modelled surface; not yet in \
the default nightly gate (oracle-clickhouse, external-blocked)",
},
#[cfg(feature = "bigquery")]
Self::BigQuery => SupportEvidence::Comparison {
tool: "sqlglot",
note: "ParseOnly cross-check over a modelled BigQuery surface; not authoritative \
(the ZetaSQL reference oracle is blocked — oracle-parity-bigquery)",
},
#[cfg(feature = "lenient")]
Self::Lenient => SupportEvidence::Constructed {
note: "permissive parse-anything union of every dialect surface; matches no single \
engine by design (oracle-parity-lenient)",
},
#[cfg(feature = "hive")]
Self::Hive => SupportEvidence::DocumentationDerived {
note: "dialect-reference library; engine-oracle acquisition blocked \
(oracle-parity-hive)",
},
#[cfg(feature = "databricks")]
Self::Databricks => SupportEvidence::DocumentationDerived {
note: "dialect-reference library; engine-oracle acquisition blocked \
(oracle-parity-databricks)",
},
#[cfg(feature = "mssql")]
Self::Mssql => SupportEvidence::DocumentationDerived {
note: "dialect-reference library; engine-oracle acquisition blocked \
(oracle-parity-mssql)",
},
#[cfg(feature = "snowflake")]
Self::Snowflake => SupportEvidence::DocumentationDerived {
note: "dialect-reference library; engine-oracle acquisition blocked \
(oracle-parity-snowflake)",
},
#[cfg(feature = "redshift")]
Self::Redshift => SupportEvidence::DocumentationDerived {
note: "dialect-reference library; engine-oracle acquisition blocked \
(oracle-parity-redshift)",
},
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum ProductSurface {
DocumentRender,
SerdeAstSchema,
WasmBindings,
PythonBindings,
}
impl ProductSurface {
pub const ALL: &'static [ProductSurface] = &[
ProductSurface::DocumentRender,
ProductSurface::SerdeAstSchema,
ProductSurface::WasmBindings,
ProductSurface::PythonBindings,
];
pub const fn id(self) -> &'static str {
match self {
Self::DocumentRender => "document-render",
Self::SerdeAstSchema => "serde-ast-schema",
Self::WasmBindings => "wasm-bindings",
Self::PythonBindings => "python-bindings",
}
}
pub const fn support_tier(self) -> SupportTier {
match self {
Self::DocumentRender => SupportTier::Preview,
Self::SerdeAstSchema => SupportTier::Stable,
Self::WasmBindings => SupportTier::Preview,
Self::PythonBindings => SupportTier::Preview,
}
}
pub const fn support_evidence(self) -> SupportEvidence {
match self {
Self::DocumentRender => SupportEvidence::Constructed {
note: "documented v1 preview: parse-back + spelling fidelity guaranteed and pinned \
by the format::coverage fixtures; full-fidelity layout remains future \
work (see the format module docs)",
},
Self::SerdeAstSchema => SupportEvidence::ContractGate {
artifact: "release/schema/wire-schema.v2.json",
note: "wire schema v2, drift-gated by the wire_schema test with the published v1 \
snapshot and compatibility baseline retained (docs/schema-contract.md)",
},
Self::WasmBindings => SupportEvidence::Constructed {
note: "npm v2 packages wrap the stable parser and wire schema v2; \
binding-specific compatibility remains preview",
},
Self::PythonBindings => SupportEvidence::Constructed {
note: "PyPI v2 wheels wrap the stable parser and wire schema v2; \
binding-specific compatibility remains preview",
},
}
}
}