Repository navigation
Conversation
Read each type with SQLQuack's parser for the dialect, or SQLBuild's own type reader where a dialect has none, and spell it the way the Polyglot-based normalization did so the same aliases stay equal. normalize_type now raises only ValueError, for an unknown dialect.
|
Moves against the Polyglot baseline, updated for 9c09e54 (28,548 outcomes: 22,655 unchanged; Contract equality. Every pair of valid spellings the baseline normalized alike still compares equal (276 groups, 800 spellings, 1,407 pairs; asserted by
New equalities on valid spellings, all aliases the baseline missed: Postgres Dialects. Only shipped dialects are known: postgres, sqlite, snowflake, clickhouse, databricks, bigquery, tsql, duckdb, and Valid spellings whose normalized text moved (canonical dialect names only):
|
MotherDuck now reads and spells types as DuckDB. MySQL and the other SQL analysis dialects no adapter ships raise Unknown dialect instead of reading as generic SQL. Under ClickHouse the type reader keeps nested type arguments, enum members with values, and named tuple fields.
Stacked on #1364, whose type parsers this reuses.
Why
Adapter type normalization was the last type path that parsed with Polyglot, and its Python binding raised the wheel's
PolyglotError. Contract and scenario checks compare types through it, so the replacement must keep the same aliases equal.Changes
same_typecompares. Only shipped dialects are known.motherduckreads as DuckDB, and other names raiseUnknown dialect.normalize_typeraises onlyValueError.PolyglotErrorand the Polyglot type-argument helper are gone.same_typefor every alias group in the Polyglot baseline: 276 groups, 800 spellings, 1,407 pairs.These pairs no longer compare equal, as corrections:
FLOAT/REAL: bareFLOATisDOUBLE PRECISION.TIMESTAMP/TIMESTAMP WITHOUT TIME ZONE: civil time isDATETIME.STRUCT(a TIMESTAMP)/STRUCT(a TIMESTAMP WITHOUT TIME ZONE).TIMESTAMP_LTZpair is gone, because MySQL is not a shipped dialect.The contracts golden drops two false Postgres K002s:
int4declared against inferredINT, andINTagainstint4.Verification
cargo test -p sqlbuild-analysis --lib, clippy and fmt.motherduck's 2,331 now equal DuckDB's, andmysql's 2,294 now raise.