Repository navigation
Snowflake DESCRIBE/SHOW, audit withholds, coverage-diff regression line, DuckShop functions - #49
Merged
Merged
Conversation
From the parser-only disagreements, each checked against receipts: - a PIVOT aggregate is a call of a column: a parenthesised column or a string argument is a syntax error, as is a string alias; - a PIVOT IN list is not empty, and ANY ORDER needs BY; - PIVOT and UNPIVOT IN values take an alias without AS; - an UNPIVOT IN list holds columns, not strings, and its name column is no reserved keyword.
Snowflake documents [ { FIRST | LAST } ( <alias> ) ] after a join's ON
or USING. The join keeps it as first_last and first_last_alias, left
out of the tree when absent; the alias refuses a reserved keyword, as
recorded. The classifier names it join_first_last, and conversion,
which accepts only the join fields it understands, refuses it.
ALTER FAILOVER GROUP / REPLICATION GROUP ADD|REMOVE accounts and ALTER CONNECTION ENABLE|DISABLE FAILOVER TO ACCOUNTS read <org_name>.<account_name> as a table reference: the account as its name, the organization as its schema, each keeping its own quoting. The joined string lost both the split and the quoting. Verdicts do not change.
…ame ) TRUNCATE [ TABLE ] [ IF EXISTS ] ERROR_TABLE ( <table> ) parses, with error_table on the tree (left out when false). In SQLQuack's own modes TRUNCATE ( name ) is a bare call, not a statement, as Snowflake refuses it; the exact check's modes still read it as polyglot does.
…n-UDF models unmeasured - `schema --functions` writes the compiled functions beside the relations. - `snowflake --functions --schema` converts each SQL function with `sqlquack function` and creates it as a DuckDB macro before models run. A function that is refused or cannot be created makes the models calling it input_unloadable, never a mismatch. - Models calling a Python function report python_udf_not_measured and are not compared or scored. - `sqlquack function` resolves sqlbuild references (`__ref(...)` and kin) in the body to the census placeholder relations, as census does for models; DuckShop's two table functions read models through `__ref`.
…d and now rejects A snapshot now lists the receipted cases Snowflake parsed, split into those the parser accepts (opaque or not) and those it rejects. diff reports base acceptances the head rejects as a regression, by case. An opaque acceptance satisfies no obligation, so a move from it to a rejection changed no form or obligation and passed unseen.
DESC WAREHOUSE v1 parsed WAREHOUSE as the target and dropped v1; DESC DATABASE and DESC SCHEMA did the same, and multi-word kinds such as COMPUTE POOL or FILE FORMAT did not parse. Snowflake DESCRIBE now reads every kind the catalogue documents, then the name and that kind's options (TYPE, REVISION, IN APPLICATION, AS RESOURCE), and refuses an unknown kind or a bare name. The shared DESCRIBE no longer drops a word that is not a property.
The shared SHOW folded every word up to a clause keyword into the kind, so SHOW DATABASES WITH USAGE, SHOW POOLS or SHOW OFFERS IN LISTING v1 parsed with the clauses swallowed or dropped. Snowflake SHOW now reads a documented kind, then LIKE, IN with the containers that kind takes (some kinds need one), the follow-up a kind takes (FOR PACKAGE, RUN, FOR METRIC...), STARTS WITH and LIMIT ... FROM with strings, and WITH PRIVILEGES as a list. GRANTS, PARAMETERS, USER and a few others keep the shared reading. An object name now refuses a reserved word in any dotted part, not only the first.
…on names and role lists From the omission audit after #46 and #48: - SELECT ALL sets select.all; it was consumed and dropped. - An aggregate of several arguments, such as APPROX_COUNT_DISTINCT ( DISTINCT a , b ), keeps distinct; the generic call dropped it. - TIMESTAMP [ ( p ) ] WITHOUT TIME ZONE is TIMESTAMP_NTZ, as its synonyms are, not bare TIMESTAMP (whose meaning follows TIMESTAMP_TYPE_MAPPING). - START TRANSACTION NAME n keeps n as the name, quoting kept, apart from NAME. - USE SECONDARY ROLES lists each role with its quoting in use.roles.
… kept fields The gate's exact check found the batch's Snowflake trees and refusals unreviewed. SHOW of PRIMARY, UNIQUE, IMPORTED and EXPORTED KEYS goes back to the shared SHOW, which read them before; SELECT ALL and the DESCRIBE property stop apply to Snowflake only, so other dialects keep their trees. The 12 statements now refused in Snowflake (a DESCRIBE without a kind, MySQL and Hive SHOW and DESCRIBE forms) are reviewed rejections. A new kept_field entry covers a field SQLQuack keeps as written where polyglot drops or infers it: the secondary role list, the container kind of SHOW ... IN a.b, and the TIMESTAMP_NTZ target of TIMESTAMP WITHOUT TIME ZONE.
Contributor
Author
|
Landed as a fast-forward of main (D122d):
|
kvlonge
added a commit
that referenced
this pull request
Nov 5, 2026
Basis: main b323a31 (PR #49), catalogue f61d213, evidence b22649e, parser tree 8067a98. - 117 forms approved (ddl 69, security_admin 33, functions 6, query 4, expressions 2, transaction_session 2, dml 1): typed DESCRIBE and SHOW, the cleared withholds (APPROX_COUNT_DISTINCT DISTINCT and -over, TIMESTAMP WITHOUT TIME ZONE, START TRANSACTION NAME, USE SECONDARY ROLES, the <org>.<account> forms) and re-reads of stale reviews. - Not approved: 7 catalogue findings (insert, unpivot, reduce, show-classes, show-databases, show-models, show-replication-databases) and 2 parser withholds (SELECT RENAME alias quoting, PIVOT alias quoting). Checker at b323a31: valid, 3476 forms, 0 problems; 1575 of 3348 verified.
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.
Batch fix/parser-gaps-d (D122/D122a). It has typed Snowflake DESCRIBE and SHOW, parser fixes from the omission audit, the DuckShop driver change, and the coverage-diff regression line (D122 decision after #45/#48).
Coverage against main 2f0c38a (head b323a31, which contains main 5cfdde2; #50 does not touch the syntax crate) (both sides on the same combined tree: catalogue + evidence + audit): forms +69 −1, obligations +1,095 −0. The D122a floor is 67 forms (2% of 3,348), so this clears it by 2.
sf.functions.approx-count-distinct.approx-count-distinct-over, is a stale review, not a lost obligation: all 17 of its obligations stay satisfied. The auditor approved it whenAPPROX_COUNT_DISTINCT ( DISTINCT 1 , 1 )dropped DISTINCT. Withhold (3) below fixes that tree, so the fingerprint changed and the form needs re-review.Parser (Snowflake only):
DESC WAREHOUSE v1took WAREHOUSE as the target and droppedv1, DESC DATABASE and DESC SCHEMA did the same, and multi-word kinds didn't parse. It also keeps TYPE, REVISION, IN APPLICATION and AS RESOURCE.FIRST|LAST ( alias ); TRUNCATE ERROR_TABLE; a failover account's<org>.<account>kept apart with its quoting (auditor withhold).select.all), DISTINCT on a multi-argument aggregate,TIMESTAMP WITHOUT TIME ZONE→ TIMESTAMP_NTZ, START TRANSACTION NAME as the name, and USE SECONDARY ROLES as a list (use.roles). The INSERT DEFAULT withhold was withdrawn; that tree is unchanged.Coverage checker: snapshots list the receipted cases Snowflake parsed, split into accepted and rejected.
difffails on base acceptances, opaque or not, that the head rejects. That is the #45 role regression's blind spot. I checked it on the 42 role cases: it reports all 42 and exits 1.DuckShop driver (coordinator ruling a–c):
schema --functionswrites the functions section.snowflake --functions --schemaconverts each SQL function withsqlquack functionand creates it as a DuckDB macro before models run. Models that call a Python function reportpython_udf_not_measuredand are not scored.sqlquack functionnow resolves__ref(…)the way census does, so DuckShop's two table functions convert. All 3 SQL functions convert, create and run.Exact-check fixes after the first gate (accaaa3, exit 2, only the
runsbinary failed): SHOW PRIMARY/UNIQUE/IMPORTED/EXPORTED KEYS goes back to the shared SHOW, which already read them. SELECT ALL and the DESCRIBE property stop now apply to Snowflake only, so PostgreSQL EXPLAIN options and SQLite trees are unchanged. 12 statements now refused in Snowflake are reviewed[[rejection]]entries: DESCRIBE without a kind, plus MySQL/Hive SHOW and DESCRIBE forms. A new[[kept_field]]kind (documented in docs/syntax.md, with a matching test) covers the secondary-role list, the container kind ofSHOW … IN a.bthat polyglot infers as SCHEMA, and the TIMESTAMP_NTZ target ofTIMESTAMP WITHOUT TIME ZONE.